This worker exposes a small mock API for testing clients. Responses are simple JSON objects that are easy to inspect and assert against.
Unless noted otherwise, every endpoint returns a JSON body in this shape:
{
"value": <any>
}
Available endpoints:
GET /boolean – random booleanGET /integer – random integer (0–99)GET /string – random colourGET /array – array of random coloursPOST /post – echo-style API response wrapper/object – simple CRUD-style endpointReturns a random boolean wrapped in a value field.
GET /boolean{
"value": true
}
Returns a random integer between 0 and 99.
GET /integer{
"value": 57
}
Returns a random colour string from a fixed list.
GET /string{
"value": "purple"
}
Returns an array of three random colours.
GET /array{
"value": ["red", "green", "blue"]
}
/post endpoint
Accepts a JSON body and returns a simple API-style wrapper with
status, statusText and data.
POST /post
Content-Type: application/json
{
"name": "Alice",
"score": 12
}
{
"value": {
"status": 200,
"statusText": "OK",
"data": {
"name": "Alice",
"score": 12
}
}
}
If a method other than POST is used, the worker returns a 405 Method Not Allowed-style object.
/object endpoint
/object is a small CRUD-style mock endpoint. It always returns an object with
status, statusText and data wrapped in the outer
value field.
GET accepts a Base64-encoded JSON string through the b64 query parameter.
The decoded JSON is returned in data. This allows you to control exactly what the mock
endpoint returns without using a request body.
{"foo":"bar","id":42}
Request:
GET /object?b64=eyJmb28iOiJiYXIiLCJpZCI6NDJ9
{
"value": {
"status": 200,
"statusText": "OK",
"data": {
"foo": "bar",
"id": 42
}
}
}
Echoes the JSON request body and marks it as created.
POST /object
Content-Type: application/json
{
"id": 42,
"name": "Han Solo"
}
{
"value": {
"status": 201,
"statusText": "Created",
"data": {
"id": 42,
"name": "Han Solo"
}
}
}
Echoes the JSON request body and marks it as updated.
PUT /object
Content-Type: application/json
{
"id": 42,
"name": "Jon Snow"
}
{
"value": {
"status": 200,
"statusText": "OK",
"data": {
"id": 42,
"name": "Jon Snow"
}
}
}
Simulates a delete. Returns a 204 No Content-style object with data: null.
DELETE /object
{
"value": {
"status": 204,
"statusText": "No Content",
"data": null
}
}
If you call a path that is not implemented, the worker returns this HTML page instead of JSON. Use one of the endpoints above to test your client.