WIP
A lightweight HTTP(S) mock proxy aimed at mocking responses of REST APIs for front-end testing purposes.
node bin/index --target=http://targethost.com --port=5001 (optional)
Where port
is the port the proxy server will listen on.
/proxy/setMockResponse
Method:
PUT
Content body
{
"url": "/the/url/to/override",
"statusCode": 500,
"body": {
"sample": "response"
},
"responseHeaders": {
"Authorization": "Bearer ABCDEFABCDEFABCDEFABCDEFABCDEF",
"X-Proxickls": "Some Mock Response Header"
}
}
- Clearing all mock responses can be cleared with sending a DELETE call to http://localhost:5080/clearAllMockResponses
- Clearing a specific mock response can be done by sending a DELETE call to http://localhost:5080/clearMockResponse with the following JSON structure as body: { "url": "/the/url/to/override" }
/proxy/clearMockResponse
Method:
DELETE
Content body
{
"url": "/the/mock/url/to/remove"
}
/proxy/clearAllMockResponses
Method:
DELETE
Generate a list of all the requests that have been proxied through the proxy server.
/proxy/listProxiedRequests?limit=50
Method:
GET
Parameters:
limit
The maximum number of requests (defaults to unlimited)
/proxy/clearProxiedCalls