RESTAssured Multipart content-type

76 views
Skip to first unread message

Kavita Kadlimatti

unread,
Oct 2, 2017, 2:24:58 PM10/2/17
to REST assured

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

Johan Haleby

unread,
Oct 3, 2017, 5:42:14 AM10/3/17
to rest-a...@googlegroups.com
I think I've fixed this in master now

On Mon, Oct 2, 2017 at 8:15 PM, Kavita Kadlimatti <kavitaka...@gmail.com> wrote:

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

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages