multipart issue

240 views
Skip to first unread message

Mootez Hichri

unread,
Dec 14, 2016, 12:09:49 AM12/14/16
to REST assured
hello, 

i'm trying tu upload a file and 2 formParm with  this code : 

given().contentType("multipart/mixed").formParam("path", "/data/files/in")
.formParam("authenticityToken", "xxxxx")
.multiPart("file", new File(filepath)).when().post(R.uriServiceUploadFile)
.then().statusCode(200);


but i'm getting this exception : 

Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: org.apache.http.entity.mime.MultipartEntityBuilder.setMimeSubtype() is applicable for argument types: (java.lang.String) values: [mixed]
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:49)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at com.jayway.restassured.internal.multipart.RestAssuredMultiPartEntity.<init>(RestAssuredMultiPartEntity.groovy:50)
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:80)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
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:263)
at com.jayway.restassured.internal.RequestSpecificationImpl$_registerRestAssuredEncoders_closure22.doCall(RequestSpecificationImpl.groovy:1369)



Johan Haleby

unread,
Dec 14, 2016, 2:12:41 AM12/14/16
to rest-a...@googlegroups.com
What version of Rest Assured are you using? And what version of Apache HTTP Client?

/Johan

--
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.

vinod komeershetty

unread,
Dec 18, 2016, 1:21:41 PM12/18/16
to REST assured
Johan I am getting the similar issue, I am using Rest assured 2.8.0 .  Also tried with 2.9.0 . No luck
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.

Johan Haleby

unread,
Dec 19, 2016, 3:07:12 AM12/19/16
to rest-a...@googlegroups.com
Try the latest version (3.0.1)

To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured+unsubscribe@googlegroups.com.

vinod komeershetty

unread,
Dec 20, 2016, 6:22:42 AM12/20/16
to rest-a...@googlegroups.com
I dont see  any gradle version for 3.0.1 here ,  https://mvnrepository.com/artifact/com.jayway.restassured/rest-assured ..  Is this updated over central repository

--
You received this message because you are subscribed to a topic in the Google Groups "REST assured" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rest-assured/iUBAWDSNHZY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rest-assured+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Thanks,
Vinod 

Johan Haleby

unread,
Dec 20, 2016, 6:24:50 AM12/20/16
to rest-a...@googlegroups.com
That's because the group id has changed, see release notes.

vinod komeershetty

unread,
Dec 20, 2016, 6:31:21 AM12/20/16
to rest-a...@googlegroups.com
Thanks Johan ,  I will try it out that

vinod komeershetty

unread,
Dec 20, 2016, 8:02:12 AM12/20/16
to rest-a...@googlegroups.com
Hi Johan,

No luck , even 3.0.1 does not have setMimeSubtype() method implementation 
--
Thanks,
Vinod 

Johan Haleby

unread,
Dec 20, 2016, 8:31:25 AM12/20/16
to rest-a...@googlegroups.com
What version of Apache HTTP Client do you have in classpath? (if you're using maven run "mvn dependency:tree")

vinod komeershetty

unread,
Dec 20, 2016, 8:50:31 AM12/20/16
to rest-a...@googlegroups.com
I am using gradle.  any help how to know

vinod komeershetty

unread,
Dec 20, 2016, 8:54:26 AM12/20/16
to rest-a...@googlegroups.com
httpclient 4.5.2
--
Thanks,
Vinod 

vinod komeershetty

unread,
Dec 20, 2016, 10:47:53 AM12/20/16
to rest-a...@googlegroups.com
Attached screenshot for the same
--
Thanks,
Vinod 

rest_Client.jpg

Johan Haleby

unread,
Dec 21, 2016, 3:46:34 AM12/21/16
to rest-a...@googlegroups.com
Hmm that's quite strange since the method seem to be there if I understand your problem correctly. If you step into the source code of MultipartEntityBuilder, doesn't the setMimeSubtype method take a string as argument? (I suppose that the argument is a string when it's passed from RA?)

vinod komeershetty

unread,
Dec 22, 2016, 8:33:33 PM12/22/16
to rest-a...@googlegroups.com, johan....@gmail.com

yes, As said i can see  implementations of other methods in source code except setMimeSubtype in  class  RestAssuredMultiPartEntity.  Attached screenshot

Please help  me  out

Thanks
Vinod
mimee.jpg

vijay kumar

unread,
Feb 2, 2017, 1:44:36 AM2/2/17
to REST assured
Hi,

I am too facing the same issue while running from gradle.How to get this fixed

vinod komeershetty

unread,
Feb 2, 2017, 6:22:54 PM2/2/17
to rest-a...@googlegroups.com
Are you using intellij??

Reply all
Reply to author
Forward
0 new messages