https://github.com/diegohce/httprecorder
httprecorder tool to mock integration tests with other microservices
https://github.com/diegohce/httprecorder
http httpproxy integration-test proxy recorder replay replay-response replay-responses request-recorder requests-recorder test unit-test
Last synced: about 1 year ago
JSON representation
httprecorder tool to mock integration tests with other microservices
- Host: GitHub
- URL: https://github.com/diegohce/httprecorder
- Owner: diegohce
- License: gpl-3.0
- Created: 2019-07-31T18:58:59.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-31T19:47:23.000Z (over 6 years ago)
- Last Synced: 2023-03-11T14:37:53.984Z (about 3 years ago)
- Topics: http, httpproxy, integration-test, proxy, recorder, replay, replay-response, replay-responses, request-recorder, requests-recorder, test, unit-test
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# httprecorder
[](https://goreportcard.com/report/github.com/diegohce/httprecorder)
[](https://github.com/diegohce/httprecorder/releases/)
[](https://github.com/diegohce/httprecorder/blob/master/LICENSE)
[](https://github.com/diegohce/httprecorder/graphs/commit-activity)
[](http://hits.dwyl.io/diegohce/httprecorder)
[](https://github.com/diegohce/httprecorder/releases/)
## What is it?
httprecorder acts almost as a normal proxy. It records http requests and responses when running in recording mode (-record), and replays the stored responses when running in replay mode (-replay).
## But why?
I use it to run microservices (simple) integration tests.
## Bind address
Default bind address and port: `0.0.0.0:8080`. It can be changed setting `HTTPRECORDER_BINDADDR` environment variable.
## Config file
`httprecorder.json` can be placed into project directory or, preferably, in `/etc/httprecorder`
* filename: Where to dump (or read from) the recorded content.
* default_host: Where every request that does not match one of `paths` will be routed to.
* paths: Where to route specific requests. If path ends with `/` it's interpreted as "begins with".
```json
{
"filename": "recording.json",
"default_host": {
"host": "http://localhost:6666"
},
"paths": {
"/badservice/status/400": {
"host": "http://localhost:6666"
},
"/badservice/status/403": {
"host": "http://localhost:6666"
},
"/badservice/status/404": {
"host": "http://localhost:6666"
},
"/data/2.5/": {
"host": "http://api.openweathermap.org:80"
}
}
}
```
# Status
httprecorder is still in a very early stage. There's code that can be improved for sure.