Http server with api to define expected http requests and responses.
1.1K
Made for own usage, i'm tired to find smth simple. I found good things in java, but mvn failed to build it. Some python soft failed with py3 compatibilyti in httplib and another strange things happened.
sources at https://github.com/zadoev/httpserverstub
Http requests examples done with https://github.com/jkbrzt/httpie tool
docker pull zadoev/httpserverstub
docker run --name=stubby -p 8181:8181 -d zadoev/httpserverstub
Or
docker run --name=stubby -p YOURLOCALPORT:8181 -d zadoev/httpserverstub
http POST 127.0.0.1:8181/ X-Stuby-Control:expect request:='{ "path": "/path", "method": "GET", "headers" : {}}' response:='{"body": "body response", "status": 301, "headers": {}}'
This command sends POST http query to http://127.0.0.1:8181/ with json data:
{
"request": {
"headers": {},
"method": "GET",
"path": "/path"
},
"response": {
"body": "body response", //this http response body will be send on matched http query
"headers": {}, // not works in this version
"status": 301 // response http status for matched request
}
}
http GET 127.0.0.1:8181/path
http POST 127.0.0.1:8181/ X-Stuby-Control:assert
HTTP/1.1 200 OK
Content-Length: 1
Content-Type: text/plain; charset=utf-8
Date: Thu, 10 Sep 2015 05:24:53 GMT
http POST 127.0.0.1:8181/ X-Stuby-Control:assert
HTTP/1.1 500 Internal Server Error
Content-Length: 25
Content-Type: text/plain; charset=utf-8
Date: Thu, 10 Sep 2015 05:26:24 GMT
No match for: GET /path
More information at https://github.com/zadoev/httpserverstub
Content type
Image
Digest
sha256:11ca3977d…
Size
213.9 MB
Last updated
about 11 years ago
docker pull zadoev/httpserverstub