A simple tool that helps to audit HTTP requests and identify the requests that exceeds the set quota. It also helps to group, sort and query requests based upon a variety of parameters.
The tool renders a simple UI that provides controls to capture the requests and print to console in a better readable format. It also provides a global object for you to manage requests.
Currently it's available in npm
. There are plans to make it available as a browser addon.
npm i http-supervisor --save-dev
Reference the script at the end of the body. Invoke httpSupervisor.init()
to start the tool.
<html>
<body>
...
<script src="node_modules/http-supervisor/http.supervisor-1.2.0.js"></script>
<script>
httpSupervisor.init();
</script>
</body>
</html>
The library exports a single object called httpSupervisor
through which you can control the audit.
The init
method helps to configure and initialize the tool with parameters passed as input. You should call this method
to start the audit and it can be called only once.
httpSupervisor.init({
domains: ['https://my.api.com'],
alertOnError: true
})
You can pass a bunch of parameters to the init
method to configure the tool which you can see at the API section.
Calling the init
method start the audit. If you stopped it for some reason and you can restart it by calling the start
method.
httpSupervisor.start();
You can temporarily stop auditing by calling stop
method.
httpSupervisor.stop();
The library provides bunch of methods to print the requests. Calling the plain print
method displays the requests
in console using the default group and sort parameters passed during the initialization. There are also methods that accepts
group, sort and search parameters and does the printing after performing the necessary operations.
httpSupervisor.print()
You can see other print methods in the API section.
You can multi-sort the requests.
httpSupervisor.sortAndPrintRequests({ field: 'method', dir: 'asc' }, { field: 'responseSize', dir: 'desc' });
You can group and sub-group requests.
httpSupervisor.groupAndPrintRequests('path', 'method');
There are also methods available that helps to group and sort in the same call.
You can also search requests on different fields passing different operators.
httpSupervisor.searchAndPrintRequests({ field: 'responseSize', operator: '>', value: '1 kb' });
*busy*
- Returns true
if the supervisor is busy audit.
TODO