Discussion:
[Cucumber] Multipart content type
(too old to reply)
Kavita Kadlimatti
2017-10-02 18:22:37 UTC
Permalink
Raw Message
I started using RESTAssured recently. I am making a REST call using the
RESTAssured library. I have an attachment in the request which I am
attaching using "multipart()" method. For my API I should be passing
"application/x-abc-xyz+xml" as the Content-Type. When I tried setting this
using " contentType()" method I get below error. However preceding the
conten-type with "multipart/" will make this error go away but I am not
getting the REST response from the server because it expects the
content-type without "multipart/" prefix. I need help in resolving this
issue. Any help would be appreciated. Thanks!



java.lang.IllegalArgumentException: *Content-Type
application/x-hub-multipart+xml is not valid when using multiparts, it must
start with "multipart/".*
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at
org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at
org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:77)
at
org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
at
io.restassured.internal.RequestSpecificationImpl.registerRestAssuredEncoders
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Chuck van der Linden
2017-10-03 16:29:16 UTC
Permalink
Raw Message
Post by Kavita Kadlimatti
I started using RESTAssured recently. I am making a REST call using the
RESTAssured library. I have an attachment in the request which I am
attaching using "multipart()" method. For my API I should be passing
"application/x-abc-xyz+xml" as the Content-Type. When I tried setting this
using " contentType()" method I get below error. However preceding the
conten-type with "multipart/" will make this error go away but I am not
getting the REST response from the server because it expects the
content-type without "multipart/" prefix. I need help in resolving this
issue. Any help would be appreciated. Thanks!
java.lang.IllegalArgumentException: *Content-Type
application/x-hub-multipart+xml is not valid when using multiparts, it must
start with "multipart/".*
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at
org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at
org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:77)
at
org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
at
io.restassured.internal.RequestSpecificationImpl.registerRestAssuredEncoders
I see nothing related to Cucumber in this question. Per the support
section in their FAQ, I suggest you seek assistance with using REST Assured
from their google groups forum
https://groups.google.com/forum/#!forum/rest-assured
--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...