generated fromsv-tools/go-repo-template
- Notifications
You must be signed in to change notification settings - Fork0
Dummy HTTP Server to be used by the e2e/integration tests
License
NotificationsYou must be signed in to change notification settings
sv-tools/mock-http-server
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
A simple HTTP Server to be used for the unit or end-to-end or integrations tests.
- yaml based configuration, see anexample config file.
- docker image is published in this repo and on the docker hub
Run docker image with the example config for the latest release:
docker run -p 8080:8080 -v$(pwd)/example_config.yaml:/config.yaml -e CONFIG=config.yaml ghcr.io/sv-tools/mock-http-server:latestOr build and run the docker image locally:
GOOS=linux GOARCH=amd64 go builddocker build --tag mock-http-server:latest.docker run -p 8080:8080 -v$(pwd)/example_config.yaml:/config.yaml -e CONFIG=config.yaml mock-http-server:latest
in second shell
curl http://localhost:8080/users -H"X-Request-Id: 123"> {"id":1,"name":"John","id":2,"name":"Jane"}curl http://localhost:8080/users/1 -H"X-Request-Id: 123"> {"id":1,"name":"John"}
The first shell should produce the following log lines:
{"time":"2025-05-20T21:30:14.551460052Z","level":"INFO","msg":"Listen on http://localhost:8080"}{"time":"2025-05-20T21:31:38.962693466Z","level":"INFO","msg":"request completed","http_scheme":"http","http_proto":"HTTP/1.1","http_method":"GET","remote_addr":"192.168.65.1:18659","user_agent":"curl/8.7.1","uri":"http://localhost:8080/users","resp_status":200,"resp_byte_length":85,"request_id":"123"}{"time":"2025-05-20T21:32:43.655666343Z","level":"INFO","msg":"request completed","http_scheme":"http","http_proto":"HTTP/1.1","http_method":"GET","remote_addr":"192.168.65.1:47480","user_agent":"curl/8.7.1","uri":"http://localhost:8080/users/1","resp_status":200,"resp_byte_length":34,"request_id":"123"}MIT licensed. See the bundledLICENSE file for more details.
About
Dummy HTTP Server to be used by the e2e/integration tests
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.