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

Custom response codes #21

Closed slonka closed 3 years ago

slonka commented 3 years ago

Hi,

would you accept a PR that makes it possible to set a custom status code? It could be triggered by a header (e.g. x-set-response-status-code: 503) or a special path /status-code/503.

This would be useful in integration tests in our project Envoy-Control: https://github.com/allegro/envoy-control/blob/835a72e920024722ce02a5ab8630be357f4b971b/envoy-control-tests/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/config/service/HttpsEchoContainer.kt#L10

If it's ok I'd create a PR.

mendhak commented 3 years ago

Hello @slonka that sounds like a neat idea. Please go for the header-trigger, it is more in line with the 'echo' concept of this image. The path-trigger is too close to the http bin image, which is far more flexible.

On the topic of tags I've recently started pushing tags, see: https://hub.docker.com/r/mendhak/http-https-echo/tags?page=1&ordering=last_updated

mendhak commented 3 years ago

Thanks for the PR (and a test! yay)

The tag :17 is available now: https://hub.docker.com/r/mendhak/http-https-echo/tags?page=1&ordering=last_updated