Sign inSign up

gijsgroenewegen/statuscode-simulator

By gijsgroenewegen

•Updated about 2 years ago

Simulate HTTP response codes and retrieve received request information during automated testing.

Image
Integration & delivery
API management
Web analytics
0

455

gijsgroenewegen/statuscode-simulator repository overview

⁠StatusCode Simulator

Java Gradle Spring Boot

A small Java application to simulate response codes and retrieve received request information. This can be useful when:

  • Testing webhook implementations
  • Checking if your application can handle response codes well
  • Integration in test automation

Contribute at: https://gitlab.com/gijs.groenewegen/java-statuscode-simulator⁠

⁠Running

docker run -d -p 8080:8080 gijsgroenewegen/statuscode-simulator

⁠Statuscode API

Sends back an HTTP statuscode based on the URL.

⁠GET/POST/PUT/PATCH
GET /statuscode/{statuscode}
POST /statuscode/{statuscode}
PUT /statuscode/{statuscode}
PATCH /statuscode/{statuscode}

Supported attributes:

AttributeTypeRequiredDescription
statuscodeintegerYesOnly 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

⁠Requests API

Gives insights into the received requests on the /statuscode/{statuscode} endpoints. Received requests are stored in-memory.

⁠GET

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":[
            "*/*"
         ]
      }
   }
]
⁠DELETE

Deletes all in-memory stored received requests.

DELETE /requests

Example request:

curl -X DELETE --url "localhost:8080/requests"

Response code 200.

Tag summary

Content type

Image

Digest

sha256:b3f3626eb…

Size

199.2 MB

Last updated

about 2 years ago

docker pull gijsgroenewegen/statuscode-simulator