httprecorder

command module
v0.0.0-...-ad4ead6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL