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

idea: respond with json provided by a file #68

Closed alexandervantrijffel closed 3 weeks ago

alexandervantrijffel commented 1 month ago

It would be great if a json file could be provided to the docker image which will be used to send as the response body for all requests. With that, we can control which response data is returned without having to send the json payload in the body of the request.

mendhak commented 4 weeks ago

I've pushed a test tag to Docker Hub, issue-67-68, if you can test it that would be great but I'll merge it later.

Set the environment variable to the file path, the file needs to be mounted in the /app directory.

docker run -d --rm -v ${PWD}/test.html:/app/test.html -p 8080:8080 -e OVERRIDE_RESPONSE_BODY_FILE_PATH=/test.html -t mendhak/http-https-echo:issue-67-68
mendhak commented 3 weeks ago

Tag :34 is now pushed to Docker Hub and Github