Search code examples
sslcurlpostmantls1.2

cURL vs Postman, different responses to HTTPS POST


We are setting up a reporting feed to a client and, in testing out the endpoint, we are receiving different responses between cURL (command-line) and Postman. In Postman, the request goes through, just fine; we get a 200-OK back. However, when we send the request in cURL, we get the following response back curl: (60) SSL certificate problem: certificate has expired

With cURL

The cURL request looks like the following:

curl -i -H "content-type: application/json" -d '{"foo": [],"bar": [],"baz": []}' https://test.example.com/notARealEndpoint

With Postman

The Postman setup is hard to display, but it's code-conversion looks like:

cURL interpretation

curl --location --request POST 'https://test.example.com/not/aReal/Endpoint' --header 'Content-Type: application/json' --header 'Content-Type: text/plain' --data-raw '{"foo": [],"bar": [],"baz": []}'

*This, by the way, returns the same certificate has expired error when run in command line

HTTP interpretation

POST /not/aReal/Endpoint HTTP/1.1
Host: test.example.com
Content-Type: application/json
Content-Type: text/plain

{"foo": [],"bar": [],"baz": []}

Solution

  • I know this is a bit dated question but I had the same issue.

    Turns out in Postman there is an option to "Follow original HTTP Method" which was for me turned off. After turning it on I get the correct response as with curl

    enter image description here