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).
I use it to run microservices (simple) integration tests.
Default bind address and port: 0.0.0.0:8080
. It can be changed setting HTTPRECORDER_BINDADDR
environment variable.
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".
{
"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"
}
}
}
httprecorder is still in a very early stage. There's code that can be improved for sure.