httpstat is a curl like tool, visualize http/https process and show the duration.
Reference from python httpstat and go httpstat
$ npm install httpstat -g
$ httpstat http://example.com/
$ httpstat -X POST -d test http://example.com/
$ npm install httpstat -S
const httpstat = require('httpstat');
httpstat('http://example.com', /* option, headers, body */).then((result) => {
console.log(result); // time property has duration time.
}).catch((e) => {
console.error(e);
});
- url, type: string,
url
is a request target url. required. - options, type: object,
options
is a http(s) request options see node http API - headers, type: array, headers is http request headers like ["Content-Type: application/json"]
- body, type: string, body is http request body