I'm trying to send a multipart request with one field but I cannot find it in the logs. My code is
Feature: test
Scenario: test send
Given url 'https://apitester.com/api/send'
And multipart field myJson = {test:'send'}
When method post
Then status 200
but in the logs I find only
1 > POST https://apitester.com/api/send
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Content-Length: 226
1 > Content-Type: multipart/mixed; boundary=57Gy9v3RTbI82kmdNf-nsWld3wK1rz6W99F
1 > Host: apitester.com
1 > User-Agent: Apache-HttpClient/4.5.12 (Java/14.0.1)
In Postman I get something like this and it's working fine:
POST /api/send HTTP/1.1
Host: apitester.com
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
----WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="myJson"
{"test":"send"}
----WebKitFormBoundary7MA4YWxkTrZu0gW
If I add And header Content-Type = 'application/json' it gets somehow similar but it's not working either:
1 > POST https://apitester.com/api/send
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Content-Length: 218
1 > Content-Type: application/json; boundary=bzLjH96ptD4G7HSRWI65XMnIhllxtiO
1 > Host: apitester.com
1 > User-Agent: Apache-HttpClient/4.5.12 (Java/14.0.1)
--bzLjH96ptD4G7HSRWI65XMnIhllxtiO
Content-Disposition: form-data; name="myJson"
Content-Type: application/json; charset=UTF-8
Content-Transfer-Encoding: 8bit
{"test":"send"}
--bzLjH96ptD4G7HSRWI65XMnIhllxtiO--
How can I troubleshoot this?