@sap-ux/axios-extension 1.25.29 → 1.25.31
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/dist/factory.js +13 -7
- package/package.json +4 -4
package/dist/factory.js
CHANGED
|
@@ -59,13 +59,6 @@ function createInstance(ProviderType, config) {
|
|
|
59
59
|
const agentOptions = {
|
|
60
60
|
rejectUnauthorized: !providerConfig.ignoreCertErrors
|
|
61
61
|
};
|
|
62
|
-
const localProxy = (0, proxy_from_env_1.getProxyForUrl)(config.baseURL);
|
|
63
|
-
if (localProxy && !(0, btp_utils_1.isAppStudio)()) {
|
|
64
|
-
// axios doesn't handle proxies correctly, instead use a custom agent with axios proxy disabled
|
|
65
|
-
providerConfig.httpsAgent = new PatchedHttpsProxyAgent(localProxy, agentOptions);
|
|
66
|
-
providerConfig.httpAgent = new http_proxy_agent_1.HttpProxyAgent(localProxy);
|
|
67
|
-
providerConfig.proxy = false;
|
|
68
|
-
}
|
|
69
62
|
// Default httpsAgent with optional parameters passed to the agent
|
|
70
63
|
if (!providerConfig.httpsAgent) {
|
|
71
64
|
providerConfig.httpsAgent = new node_https_1.Agent(agentOptions);
|
|
@@ -80,6 +73,19 @@ function createInstance(ProviderType, config) {
|
|
|
80
73
|
*/
|
|
81
74
|
providerConfig.validateStatus = (status) => status < 400;
|
|
82
75
|
const instance = new ProviderType(providerConfig);
|
|
76
|
+
// Resolve proxy per-request using the full URL (baseURL + path + params) so that
|
|
77
|
+
// NO_PROXY hostname matching works correctly against the actual target URL.
|
|
78
|
+
instance.interceptors.request.use((request) => {
|
|
79
|
+
const fullUrl = instance.getUri(request);
|
|
80
|
+
const localProxy = (0, proxy_from_env_1.getProxyForUrl)(fullUrl);
|
|
81
|
+
if (localProxy && !(0, btp_utils_1.isAppStudio)()) {
|
|
82
|
+
// axios doesn't handle proxies correctly, instead use a custom agent with axios proxy disabled
|
|
83
|
+
request.httpsAgent = new PatchedHttpsProxyAgent(localProxy, agentOptions);
|
|
84
|
+
request.httpAgent = new http_proxy_agent_1.HttpProxyAgent(localProxy);
|
|
85
|
+
request.proxy = false;
|
|
86
|
+
}
|
|
87
|
+
return request;
|
|
88
|
+
});
|
|
83
89
|
instance.defaults.headers = instance.defaults.headers ?? {
|
|
84
90
|
common: {},
|
|
85
91
|
'delete': {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/axios-extension",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.31",
|
|
4
4
|
"description": "Extension of the Axios module adding convenience methods to interact with SAP systems especially with OData services.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"private": false,
|
|
15
15
|
"main": "dist/index.js",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"axios": "1.
|
|
17
|
+
"axios": "1.15.0",
|
|
18
18
|
"detect-content-type": "1.2.0",
|
|
19
19
|
"fast-xml-parser": "5.5.9",
|
|
20
20
|
"lodash": "4.18.1",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"https-proxy-agent": "7.0.6",
|
|
26
26
|
"http-proxy-agent": "7.0.2",
|
|
27
27
|
"proxy-from-env": "1.1.0",
|
|
28
|
-
"@sap-ux/btp-utils": "1.1.
|
|
28
|
+
"@sap-ux/btp-utils": "1.1.14",
|
|
29
29
|
"@sap-ux/logger": "0.8.5",
|
|
30
30
|
"@sap-ux/feature-toggle": "0.3.8"
|
|
31
31
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"nock": "14.0.11",
|
|
36
36
|
"supertest": "7.2.2",
|
|
37
37
|
"@types/proxy-from-env": "1.0.4",
|
|
38
|
-
"@sap-ux/project-access": "1.35.
|
|
38
|
+
"@sap-ux/project-access": "1.35.20"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
41
41
|
"dist",
|