问题
For POST api having body as jwt karate is unable to send body having content-type as application/jwt.
Whereas while i perform the same through Postman it works. Let me know if i am missing anything.
My API request is:
1 > POST "Sever URL"
1 > Accept-Encoding: gzip,deflate
1 > Connection: Keep-Alive
1 > Content-Length: 4959
1 > Content-Type: application/jwt
1 > Host: auth-sandbox.apiboitest.com
1 > User-Agent: Apache-HttpClient/4.5.5 (Java/1.8.0_144)
here the body is not getting passed which is been sent: Given url DCRurl And header Content-Type = 'application/jwt' And request payload_body_of_type_jwt When method POST
回答1:
Try the following:
- see if you are missing an
Accept
header that postman may be sending - try to convert the value of the
request
to string before making the request - try
* configure charset = null
before making the request if the server does not handle the charset, which is passed asUTF-8
by default
Otherwise there is not enough info to tell what is wrong from your question.
来源:https://stackoverflow.com/questions/54109901/karate-api-tests-api-post-request-unable-to-send-body-when-content-type-is-app