rest-interceptor-responsetime

1.0.1 • Public • Published

rest-interceptor-responsetime

Measure response times with rest.js

Use this when you want to measure HTTP response times while using rest.js. You can access the response time in response.time.

Installation

$ npm install rest-interceptor-responsetime

Usage

var rest = require('rest');
var responseTime = require('rest-interceptor-responsetime');
 
rest.wrap('responseTime');
 
rest('http://someurl').then(function(response){
    console.log(response.time);
}).catch(function(response){
    console.log(response.time); // only exists if the server has responded with an HTTP status, not on internal errors
});

Measurement units

response.time is reported in milliseconds.

Precision

response.time has nanosecond precision. You can multiple response.time by 1e6 to convert to nanoseconds.

Package Sidebar

Install

npm i rest-interceptor-responsetime

Weekly Downloads

50

Version

1.0.1

License

MIT

Last publish

Collaborators

  • hifaraz