Assert whether HTTP response status code matches the specified value.
Parameters:
Name | Type | Description |
|
| A request URL to match verbatim or a RegExp. |
|
| A response status code to match verbatim or a RegExp. |
|
|
|
|
|
|
Returns:
Object
- Network request details if the network request was found.
Assert if network request matching the specified URL.
Parameters:
Name | Type | Description |
|
| A request URL to match verbatim or a RegExp. |
|
|
|
Returns:
Object
- Network request details if the network request was found.
Disposes this module.
Return all the collected network requests so far.
Returns:
Array.<Object>
- Array containing network requests.
Initializes proxy.
Launching mitmproxy manually:
mitmdump --anticache -s mitmproxy-node\scripts\proxy.py --ssl-insecure --set httpCommPort=8765
Parameters:
Name | Type | Description |
|
| Proxy port. |
|
|
|
|
|
|
|
|
|
Begin collecting network requests.
Any previously collected requests will be discarded.
Usage example:
proxy.init(8080);proxy.start();// print the collected request so far:let requests = proxy.getRequests();for (let req of requests) {log.info(req);}// wait for a request using a verbatim URL match:proxy.waitForUrl('https://www.yourwebsite.com/foo/bar');// wait for a request using a regular expression URL match:proxy.waitForUrl(/https:\/\/.*\/foo\/bar/);// wait for a request using a custom matcher:proxy.waitFor(function (request) {return request.status === '200' && request.url === 'https://www.yourwebsite.com/foo/bar';});
Stop collecting network requests.
Wait for a network request.
Parameters:
Name | Type | Description |
|
| Matching function. Should return true on match, or false otherwise. |
|
|
|
Returns:
Object
- Network request details if the network request was found.
Wait for a network request matching the specified URL.
Parameters:
Name | Type | Description |
|
| An URL to match verbatim or a RegExp. |
|
|
|
Returns:
Object
- Network request details if the network request was found.