Karate v1.4.0 - Multipart not working when executed from jar file

I have a feature where I send a request with a multipart file using this line:

And multipart file csvFile = {read: '#(filePath)', contentType:'multipart/form-data'}

This is working perfectly with the Karate v1.4.0 from my local eclipse but when I compile as jar file and execute with "java -jar" command, the test is not working, it's sending the request with the file but the server is saying the multi-part is not right.

When I try the same with Karate v1.3.1 everything works perfectly, it seems something related with the version 1.4.0.

Has someone the same problem with multipart with the latest version?

INFO:

Log when it works v1.4.0 from eclipse:

enter image description here

Log when it doesn't work from jar file:

enter image description here

Upvotes: 1

Views: 158

Answers (1)

I don't know the real reason but I solved it, adding to the multipart command a 'filename' attribute:

And multipart file csvFile = {read: '#(filePath)', contentType:'multipart/form-data', filename: '#(fileName)'}

It's strange because following the documentation (https://github.com/karatelabs/karate#multipart-file) the "filename" attribute is optional. Maybe it's a workaround to solve the problem in the v.1.4.0

I don't know if this bug is going to be resolved on karate next version or otherwise the karate doc must be changed.

Upvotes: 1

Related Questions