Use API as Proxy

When working with an existing API it can be useful to pass some requests through to it for testing, while serving mock responses for others.

For instance, if an API is not yet fully implemented then testing progress can still be made for the calling application by mocking the parts not yet completed.

Additionally, proxying all but a selection of APIs enables testing of edge and failure cases that would be hard to replicate predictably in the target API.

How to configure proxy settings

You can configure proxy settings for each of your mock API. All you have to do is click the Configure proxy server icon and provide the the proxy url you want to forward your mock API request.

Once you are done with configuring your proxy settings, you can now enable Use API as Proxy settings to start proxing your call to the provided url.

Once a mock API is configured and enabled to serve a proxy response, all of the normal request matching rules apply, but instead of returning a saved response, the request is forwarded to the target url.

The endpoint of a request’s URL will be replaced by the proxy url i.e. if a request made to https://api.mocklets.com/mock12675/pets would result in a proxy request to https://your.server.com/pets.

Whenever a request is proxied, Mocklets adds 2 headers to the response with the details about the proxied request.

x-mocklets-proxy-url: https://your.server.com/pets
x-mocklets-type: proxy