Simulate HTTP response codes and retrieve received request information during automated testing.
455
A small Java application to simulate response codes and retrieve received request information. This can be useful when:
Contribute at: https://gitlab.com/gijs.groenewegen/java-statuscode-simulator
docker run -d -p 8080:8080 gijsgroenewegen/statuscode-simulator
Sends back an HTTP statuscode based on the URL.
GET /statuscode/{statuscode}
POST /statuscode/{statuscode}
PUT /statuscode/{statuscode}
PATCH /statuscode/{statuscode}
Supported attributes:
| Attribute | Type | Required | Description |
|---|---|---|---|
statuscode | integer | Yes | Only supports HTTP defined status codes |
If a valid statuscode is supplied that status code is returned and the response contains the HTTP description.
If an invalid statuscode is supplied, a 404 will be returned.
Example request:
curl --url "localhost:8080/statuscode/201"
Example response (statuscode 201):
CREATED
Gives insights into the received requests on the /statuscode/{statuscode} endpoints. Received requests are stored in-memory.
Lists all in-memory stored received requests.
GET /requests
Example request:
curl --url "localhost:8080/requests"
Example response (statuscode 200):
[
{
"path":"/statuscode/200",
"method":"GET",
"body":null,
"headers":{
"host":[
"localhost:8080"
],
"accept":[
"*/*"
]
}
}
]
Deletes all in-memory stored received requests.
DELETE /requests
Example request:
curl -X DELETE --url "localhost:8080/requests"
Response code 200.
Content type
Image
Digest
sha256:b3f3626eb…
Size
199.2 MB
Last updated
about 2 years ago
docker pull gijsgroenewegen/statuscode-simulator