Where can I find the fuction library for advanced mocking? I’m looking for a way to extract request url adding it to the response header as a parameter.
- Use
$.mockRequest.url.toString()
to retrieve the request URL. - Utilize
$.mockResponse.headers.upsert
to specify the response header. - Choose the
Local Mock
environment for testing your outcome.
Below is an example demonstrating how to print the test as the response body:
$.mockResponse.setBody({
keys: Object.keys($.mockRequest),
url: $.mockRequest.url.toString()
});
For more comprehensive documentation, please refer to Mock expectations - Apidog Docs.