no signature of method - wslite.rest.ContentBuilder.multipart() error - when trying to POST multipart
Rubathas opened this issue · comments
Hi,
I get the following error:
ERROR:groovy.lang.MissingMethodException: No signature of method: wslite.rest.ContentBuilder.multipart() is applicable for argument types: ([B) values: [[102, 105, 108, 101, 65, 114, 114]]
If I try to run the following code:
def client = new RESTClient(url)
def fileArr = new File("xmlResponse.xml").bytes
client.post( path:'/attachment?entityId=298&entityType=EXECUTION') { multipart 'file', fileArr}
and also the same error if I try with this:
def client = new RESTClient(url)
byte[] arrayIn = [102, 105, 108, 101, 65, 114, 114]
client.post( path:'/attachment?entityId=298&entityType=EXECUTION') { multipart 'file', arrayIn}
Any idea why this is giving me an error? I have followed the section:
def response = client.post() {
// call once for each body-part
multipart 'username', 'antony'.bytes
multipart 'files[myfile.png]', myFile.bytes
// specify content-type and filename
multipart 'inputFile', 'test'.bytes, 'image/png', 'test.png'
}
from: https://github.com/jwagenleitner/groovy-wslite
However, I do not understand why the client.post is failing.
Look forward to any ideas/comments.
Thanks,
Rubathas
Hello Rubathas,
I had this error in one of my modules. That was strange as the code was working in another project. After some investigation, I noticed that the multipart method wasn't found in wslite 1.1.0. Bumping the wslite version to 1.1.2 solved the issue.
Regards,
Hélain Schoonjans