@autofleet/network 1.2.9-alpha-2 → 1.2.9-alpha-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +0 -22
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2,7 +2,6 @@ const axios = require('axios');
|
|
|
2
2
|
const http = require('http');
|
|
3
3
|
const https = require('https');
|
|
4
4
|
const axiosRetry = require('axios-retry');
|
|
5
|
-
const { Logger } = require('@autofleet/node-common');
|
|
6
5
|
const qs = require('qs');
|
|
7
6
|
const httpAdapter = require('axios/lib/adapters/http');
|
|
8
7
|
const merge = require('deepmerge');
|
|
@@ -78,27 +77,6 @@ module.exports = class Network {
|
|
|
78
77
|
});
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
addLogs() {
|
|
82
|
-
const logger = Logger();
|
|
83
|
-
this.axios.interceptors.request.use((request) => {
|
|
84
|
-
logger.info(`Start Request: [${request.method.toUpperCase()}] ${request.baseURL} ${request.url}`, {
|
|
85
|
-
headers: request.headers,
|
|
86
|
-
query: request.query,
|
|
87
|
-
body: request.body,
|
|
88
|
-
params: request.params,
|
|
89
|
-
});
|
|
90
|
-
return request;
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
this.axios.interceptors.response.use((response) => {
|
|
94
|
-
logger.info(`Finish Request: [${response.config.method.toUpperCase()} ${response.config.url}`);
|
|
95
|
-
return response;
|
|
96
|
-
}, (error) => {
|
|
97
|
-
logger.error('Finish Request with error', { status: error.status, data: error.response && error.response.data });
|
|
98
|
-
throw error;
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
80
|
createBaseUrl() {
|
|
103
81
|
if (!this.settings.serviceUrl && !this.settings.serviceName) {
|
|
104
82
|
throw new Error('At least one of the settings Missing serviceUrl or serviceName');
|