This is very useful when developing integration tests, for example, because you can redirect requests to the original host and modify its responses. So, you can start developing integration tests before the real API is modified according to the new contract.
proxy route handler uses the express-http-proxy package under the hood, and supports all of its options.
Mocks server common properties to all variants are in cursive. Specific properties of the proxy handler are in bold:
id(String): Id of the route variant.
handler(String): Must be "proxy".
delay(Number|null): Milliseconds of delay for this variant.
host(String|Function): The proxy host. Equivalent to the
hostoption, so it can also be a function.
options(Object): Object containing any of the options supported by the
express-http-proxypackage. Some of them are:
Tip: Note that the
delayoption is still valid, so you can use it to simulate that host responses are slow.
Read the proxy route variants guide to get some suggestions about how to use it.