axios-time

1.0.0 • Public • Published

npm

axios-time

Axios plugin to measure the actual time it takes for a request to complete

Installation

You can install this plugin using NPM

> npm i axios-time

Basic Usage

The example below will add timing data to the request-response cycle.

const axios = require('axios');
const axiosTime = require('axios-time');
 
axiosTime(axios);
 
try {
    const response = await axios.get('/user');
} catch(err) {
}

response.timings object example:

{
  "timingEnd": 1599035291441,   // Timestamp of the start of the request (in Unix Epoch milliseconds).
  "timingStart": 1599035289182, // Timestamp when the response ended (in Unix Epoch milliseconds).
  "elapsedTime": 2259           // Duration of the entire request/response in milliseconds.
}

Readme

Keywords

none

Package Sidebar

Install

npm i axios-time

Weekly Downloads

2,489

Version

1.0.0

License

Apache-2.0

Unpacked Size

13.6 kB

Total Files

4

Last publish

Collaborators

  • ido_payu
  • kobic
  • rio182