Thanks to visit codestin.com
Credit goes to github.com

Skip to content

httprecorder tool to mock integration tests with other microservices

License

Notifications You must be signed in to change notification settings

diegohce/httprecorder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

httprecorder

Go Report Card Github all releases GPLv3 license Maintenance HitCount Generic badge

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".
{
	"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.

Releases

No releases published

Packages

No packages published

Languages