1.0.1 • Published 8 years ago

rest-interceptor-responsetime v1.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

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.