-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gunzip request and Gzipped again does not behave correctly #161
Comments
Maybe the fault is the Chunking? Because if i replace the buffer in |
Ok, so you're using Mockttp in front of HTTP Toolkit, is that right? I.e. the client requests goes through Mockttp, and then gets forwarded to HTTP Toolkit? That's unusual (normally it makes more sense to put Mockttp on the upstream side as a proxy, between HTTP Toolkit & the target server) but yes it should work if that's what you want. In general, if the content-encoding header is correct, Mockttp will automatically decode & re-encode request In either case though, the main problem here must be your
I think you probably want to:
In each case here, from what I can see both Mockttp & HTTP Toolkit are working correctly, the issue is that your code is explicitly trying to send an HTTP request that basically doesn't make sense. Mockttp will mostly handle things automatically to make sure requests are valid, but if you directly provide invalid headers etc then it won't stop you. If you can provide a demo with your full code, that would help a lot to be more specific about what's going on here. |
Well i am actually using HttpToolkit to see if my modified requests are formatted and changed exactly how i want them to be before sending them to the Upstream. Its extremly usefull for debugging since just using the console is not that great. Im currently unable to provide an example but i see the problem now. i mentioned in #160 How im handling requests with calling beforeRequest and calling different beforeReqeusts. Apperently this does not work for Chunked requests since you only get a portion of it. And then the gzip is malformed.
If thats true then it would make sense why i saw many weird malformed requests before. |
Can you explain exactly what you mean by 'chunked' requests? It would be very helpful to be able to reproduce what you're seeing because there's something quite unusual happening here. Can you share an example request I can test with curl that doesn't work as expected, for example? If you're talking about I think your main problem here almost certainly comes down to how you're updating the headers to match the changes you're making to the body, but it's difficult to be more specific without being able to see the code. |
When trying to manipulate a beforeResponse, gunzip the request and gzip it again and set the
request.body.buffer = zlib.gzipSync(request.body.buffer)
and catching this with HttpToolkit this happends,I dont know if this is a HttpToolkit issue or a Mockttp issue
Its possible i also misunderstanding something or mockttp already gunzip or gzips, that i dont know of
Or this happens
The text was updated successfully, but these errors were encountered: