@pm2/js-api
Advanced tools
Comparing version 0.7.0 to 0.8.0
{ | ||
"name": "@pm2/js-api", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "PM2.io API Client for Javascript", | ||
@@ -37,3 +37,3 @@ "main": "index.js", | ||
"async": "^2.6.3", | ||
"axios": "^0.21.0", | ||
"extrareqp2": "^1.0.0", | ||
"debug": "~4.3.1", | ||
@@ -40,0 +40,0 @@ "eventemitter2": "^6.3.1", |
'use strict' | ||
const axios = require('axios') | ||
const extrareqp2 = require('extrareqp2') | ||
const AuthStrategy = require('./auth_strategies/strategy') | ||
@@ -28,3 +28,3 @@ const constants = require('../constants') | ||
this._queue = [] | ||
this._axios = axios.create(opts) | ||
this._extrareqp2 = extrareqp2.create(opts) | ||
this._websockets = [] | ||
@@ -74,3 +74,3 @@ this._endpoints = new Map() | ||
this._axios.interceptors.response.use( | ||
this._extrareqp2.interceptors.response.use( | ||
response => { | ||
@@ -113,3 +113,3 @@ updateApiDateLag(response) | ||
if (!this._endpoints.has(bucketID)) { | ||
const promise = this._axios.request({ | ||
const promise = this._extrareqp2.request({ | ||
url: `/api/bucket/${bucketID}`, | ||
@@ -185,3 +185,3 @@ method: 'GET', | ||
this._axios.request(httpOpts) | ||
this._extrareqp2.request(httpOpts) | ||
.then(successNext) | ||
@@ -214,3 +214,3 @@ .catch((error) => { | ||
httpOpts.headers.Authorization = `Bearer ${this.tokens.access_token}` | ||
return this._axios.request(httpOpts).then(successNext).catch(next) | ||
return this._extrareqp2.request(httpOpts).then(successNext).catch(next) | ||
}) | ||
@@ -255,4 +255,4 @@ }) | ||
this._websockets.forEach(websocket => websocket.updateAuthorization(data.access_token)) | ||
this._axios.defaults.headers.common['Authorization'] = `Bearer ${data.access_token}` | ||
this._axios.request({ | ||
this._extrareqp2.defaults.headers.common['Authorization'] = `Bearer ${data.access_token}` | ||
this._extrareqp2.request({ | ||
url: '/api/bucket', | ||
@@ -259,0 +259,0 @@ method: 'GET', |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
982142
13170
+ Addedextrareqp2@^1.0.0
+ Addedextrareqp2@1.0.0(transitive)
- Removedaxios@^0.21.0
- Removedaxios@0.21.4(transitive)