prism: Postman plus Prism Proxy causes errors
Describe the bug I use Postman (https://www.postman.com/) with Prism, with good results. When I put Prism into proxy mode, Postman thinks it didn’t get a response (but curl to the same endpoint works fine).
Prism shows no error messages, the output from Prism is identical whether I make the request through Postman or curl
Postman’s console says “incorrect header check”
curl shows that Prism is returning a header content-encoding: gzip, which I don’t get when I request the live API directly rather than via the Prism proxy.
To Reproduce
- Given this OpenAPI document (actually I’m not sure it matters but I’m using https://github.com/Nexmo/api-specification/blob/master/definitions/verify.yml and hitting the
search/endpoint - Run this CLI command
prism proxy verify.yml https://api.nexmo.com/verify - Make a request to the Search endpoint using Postman
Expected behavior The API response
Environment (remove any that are not applicable):
- Library version: 3.2.9
- OS: Ubuntu 18.04
- Postman 7.21.1
- curl: 7.58.0
Additional context
I managed to get things working by adding an additional header to Postman Accept-Encoding and leaving it empty - I think Postman sends this header by default. However curl does not send Accept-Encoding by default and I still see that Prism returns a content-encoding: gzip to curl so while I’m not sure Postman is sending correct headers, I think Prism is also adding something here that doesn’t help!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 24 (12 by maintainers)
I am facing this issue too. Prism 4.1.2, node.js both 12.19.1 and 14.15.1.
It is clearly not specific to Postman. From my observation, the issue can be generalised as this:
Accept-Encoding: gzipheaderContent-Encoding: gzipheaderContent-Encoding: gzipheader BUT with un-gzipped (decoded) bodySolution would be either not to decode the body and return it intact, or (as hotfix) strip the Content-Encoding header
@hilary Thanks for the detailed explanation! With these new details I’ll reopen the issue and try to reproduce!
Thanks @lornajane, your workaround is working for us, too.
Hi @XVincentX. We’re also having the same problem. To reproduce, run
not
The problem we’re encountering is with Postman (and
newman) throughprismrunning as a validation proxy. We also encountered the same problem usinghttpiewithprism proxy.As best we can tell, the problem is happening because:
Accept-Encoding: gzip, deflateheader to requestsWhen the header is not sent by the client, everything works fine.
Whether the header is sent by the client or not should not affect the behavior of the validation proxy, given that the spec does not specify that the response is encoded.
@arunvangapelli That hasn’t been released yet in the 3.x branch; you need to either install the beta tag or clone the master branch directly.
I’ll try to publish this in the 3.x on Monday or so.