https://github.com/payu/axios-time
Axios interceptor for adding request and response times
https://github.com/payu/axios-time
Last synced: about 1 year ago
JSON representation
Axios interceptor for adding request and response times
- Host: GitHub
- URL: https://github.com/payu/axios-time
- Owner: PayU
- License: apache-2.0
- Created: 2020-08-31T08:35:26.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-07T13:12:04.000Z (about 3 years ago)
- Last Synced: 2025-05-16T22:14:07.597Z (about 1 year ago)
- Language: JavaScript
- Size: 55.7 KB
- Stars: 3
- Watchers: 16
- Forks: 5
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# axios-time
Axios plugin to measure the actual time it takes for a request to complete
## Installation
You can install this plugin using **NPM**
```bash
> npm i axios-time
```
## Basic Usage
The example below will add timing data to the request-response cycle.
```js
const axios = require('axios');
const axiosTime = require('axios-time');
axiosTime(axios);
try {
const response = await axios.get('/user');
} catch(err) {
}
```
response.timings object example:
```js
{
"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.
}
```