mendhak / docker-http-https-echo

Docker image that echoes request data as JSON; listens on HTTP/S, useful for debugging.
https://code.mendhak.com/docker-http-https-echo/
MIT License
621 stars 136 forks source link

Add support for requesting raw response body #37

Closed natexcvi closed 2 years ago

natexcvi commented 2 years ago

If the request query string contains flag raw_response=true, the server will return the request body as the response body as is, without wrapping it in the meta-object containing other request info.

mendhak commented 2 years ago

Hey thanks for this. I did a test and I think I understand what this is doing - just sending the body back. In that case the parameter name should be more like, response_body_only=true, since that describes what it's doing a bit better.

Also question, what's the purpose of the Buffer.send(), couldn't it just be a res.send(req.body)?

natexcvi commented 2 years ago

Changed the query param name to response_body_only. Using Buffer was indeed redundant so I removed it.

mendhak commented 2 years ago

OK thanks for that, tag :24 is now on Docker Hub.

https://hub.docker.com/r/mendhak/http-https-echo/tags?page=1&ordering=last_updated