gomparator compares HTTP GET JSON responses from different hosts by checking if they respond with the same json (deep equal ignoring order) and status code.
go get -u github.com/emacampolo/gomparator
eg:
/v1/payment_methods?client.id=1
/v1/payment_methods?client.id=2
/v1/payment_methods?client.id=3
$ gomparator --path "/path/to/file/with/urls" --host "http://host1.com" --host "http://host2.com" -H "X-Auth-Token: abc"
By Default, it will use 1 worker, and the rate limit will be 5 req/s
Shows a list of commands or help for one command
Print the version
Specifies the file from which to read targets. It should contain one column only with a rel path. eg: /v1/cards?query=123
Targeted hosts. Exactly 2 hosts must be specified. eg: --host 'http://host1.com --host 'http://host2.com'
Headers to be used in the http call
Operation rate limit per second (default: 5)
Number of workers running concurrently (default: 1)
Whether it only compares status code ignoring response body
Request timeout (default: 30s)
Duration of the comparison [0 = forever] (default: 0s)
Excludes a value from both json for the specified path. A path is a series of keys separated by a dot or #.
Given the following json input:
{
"name": {"first": "Tom", "last": "Anderson"},
"friends": [
{"first": "James", "last": "Murphy"},
{"first": "Roger", "last": "Craig"}
]
}
path | output |
---|---|
"name.friends" |
{
"name": {"first": "Tom", "last": "Anderson"}
}
|
"friends.#.last" |
{
"name": {"first": "Tom", "last": "Anderson"},
"friends": [
{"first": "James"},
{"first": "Roger"}
]
}
|