'Request working in curl but not in postman
This request working with curl
curl 'http://www.express.com/browse/gadgets/store-change-location-more.jsp?changelocation=true&catelogRefId=75116576' -H 'Cookie: JSESSIONID=6D26018EFF8B54EC4022299B2AC7B184.cmhlpecomecm02w2;' --compressed
But the same request not working in post man
Post man request
Request Type : GET
URL : http://www.express.com/browse/gadgets/store-change-location-more.jsp?changelocation=true&catelogRefId=75116576
Headers:
Cookie: JSESSIONID=6D26018EFF8B54EC4022299B2AC7B184.cmhlpecomecm02w2;
How to make request work with post man too?
Solution 1:[1]
Intermittently happened to me as well. I tried these steps:
- Go to settings, disable Send Postman Token Header
- Disable Interceptor (The satellite icon at the top)
Not sure why, but it simply worked!
Solution 2:[2]
In my case, only the requests to localhost were working. This happened after it synchronized with other instances I was logged into.
After I disabled SSL certificate verification in Settings->General, it started working again.
Solution 3:[3]
In my case it was a newline at the end of url in Postman. There actually WAS a newline indicator in url bar, but it looked more like a dirt on the monitor so I missed it. Also the curl WAS in fact generated correctly, but I initially thought it is some issue regarding single or double quotas on Windows so I was changing them and also deleting the newline happily without thinking to make it work ...
Solution 4:[4]
In my case, the request was failing because I was hitting an internal resource being served over HTTPS. Disabling SSL Certificate Validation in the Postman preferences fixed it for me.
Solution 5:[5]
In my case, I'm running an HTTP process in localhost (port 8090)
The curl request generated by pressing the Code button in Postman works fine, returning the expected results i.e:
curl -X GET 'http://localhost:8090/tel-2/customers' -H 'Content-Type: application/json'
When I attempt to run it through the GUI I get back an HTTP 400 with an HTML error response as follows (<style>
section omitted for brevity).
<!doctype html>
<html lang="en">
<head>
<title>HTTP Status 400 – Bad Request</title>
</head>
<body>
<h1>HTTP Status 400 – Bad Request</h1>
</body>
</html>
When I access the URL through the browser also works fine.
I have attempted to re-install Postman but the problem persists. The Postman version that I'm using is Desktop 7.31.1, the latest at the moment.
Finally, I uninstalled Postman desktop completely and the older Chrome version 5.5.5 works as expected.
Solution 6:[6]
Are you behind a proxy? I'm having a similar issue and I believe the issue is the handshaking protocol with the proxy not being applied to the postman application.
Solution 7:[7]
In my case, I was accidentally added extra /
e.g: www.test.com//endpoint in Postman address but when saving to CODE, Postman reformatted it and removed extra /
.
Solution 8:[8]
My API request was taking around 4000ms to return a response while timeout was set to 1000ms in postman settings.
After I set Settings->General->Request timeout in ms(0 for infinity) to 0, it started working fine.
Solution 9:[9]
My problem isn't directly related to Postman but was in adding an extra /
to end of REST resource, so I got 404. The solution is simply do not add extra space for
the REST listing resource:
example.com/api/items/
-> example.com/api/items
Solution 10:[10]
My use case was that I was trying to get oauth2 token, and had the client-id
and client-secret
as key-value pairs in the x-www-form-urlencoded
section of the request body
.
I kept getting an error saying
{
"fault": {
"faultstring":"Invalid client identifier {0}",
"detail": {"errorcode":"oauth.v2.InvalidClientIdentifier"}
}
}
The solution was to put credentials into the raw
section of the request body
instead, as follows:
grant_type=client_credentials&client_id=some-client-id&client_secret=some-client-secret
Got the token after that.
Solution 11:[11]
I had to make sure all the hidden auto-generated headers in postman were checked/enabled. I had initially disabled them which was causing this issue for me.
Solution 12:[12]
I had an even sillyer issue!
The cURL created by chrome worked, but when I imported it into Postman it didn't.
Only I'd forgot to change the method type in postman to POST instead of GET ?
Solution 13:[13]
One case not discussed yet: curl will attempt to use HTTP 2 where available, while Postman only supports HTTP 1.1.
I ran into an api that returned a 500 when the connection used 1.1, which meant the calls were working with curl but failing with postman. When I passed the --http1.1
flag to curl, it got the same response as Postman.
More generally, running curl in verbose mode (with the -v
flag) can help you figure out what could be different between the two requests.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow