Hilo Doki
Hilo Doki

Reputation: 35

Multipart Content-Type header is updated by Karate when sending requests

I provide my header parameters as a json file which looks like below;

{ 
  "Accept": "application/x-ofx",
  "Content-Type" "Multipart/Related; type=text/xml; boundary=---=1234abc;"
}

I have a few more parameters but not as important as these 2 above. So, When I read this from json file and send my request to our api, I see 400 and when I run the same test in debug mode I saw that Content-Type is updated when it is sent as below;

Content-Type: multipart/related; type="text/xml"; boundary="---=1234abc"

I found that we can get rid of charset using configure charset = null I did that. we are fine there. It is also making M and R letters in Multipart/Related lowercase. And there are quotes around type and boundary.

I have sent another request using exact same data except the type in Content-Type being type=application/x-ofx and it is working fine and not updated as lowercase or anything else. What would be the issue here.

Thanks already for your help and support with this great tool.

Upvotes: 2

Views: 1033

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

Can you try with the RC version since we are focusing on that: https://github.com/intuit/karate/wiki/1.0-upgrade-guide

If you are sending a multipart request, the HTTP client is supposed to take care of the boundary for you. And as per the HTTP spec, the header values are treated as case-insensitive.

So if you still see an issue, kindly follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

And if you are really trying to simulate some HTTP edge case, refer: https://stackoverflow.com/a/66252481/143475

Upvotes: 1

Related Questions