@umijs/server 3.5.31 → 3.5.34
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/lib/Server/Server.js +10 -4
- package/package.json +4 -4
package/lib/Server/Server.js
CHANGED
|
@@ -313,14 +313,20 @@ class Server {
|
|
|
313
313
|
// However, the proxy middleware has no use in this case, and will fail to instantiate.
|
|
314
314
|
|
|
315
315
|
if (proxyConfig.target) {
|
|
316
|
+
const target = typeof proxyConfig.target === 'object' ? url().format(proxyConfig.target) : proxyConfig.target;
|
|
316
317
|
return (0, _httpProxyMiddleware().createProxyMiddleware)(context, _objectSpread(_objectSpread({}, proxyConfig), {}, {
|
|
318
|
+
onProxyReq(proxyReq, req, res) {
|
|
319
|
+
var _proxyConfig$onProxyR;
|
|
320
|
+
|
|
321
|
+
(_proxyConfig$onProxyR = proxyConfig.onProxyReq) === null || _proxyConfig$onProxyR === void 0 ? void 0 : _proxyConfig$onProxyR.call(proxyConfig, proxyReq, req, res);
|
|
322
|
+
},
|
|
323
|
+
|
|
317
324
|
onProxyRes(proxyRes, req, res) {
|
|
318
|
-
var _URL, _proxyConfig$
|
|
325
|
+
var _URL, _proxyConfig$onProxyR2;
|
|
319
326
|
|
|
320
|
-
const target = typeof proxyConfig.target === 'object' ? url().format(proxyConfig.target) : proxyConfig.target;
|
|
321
327
|
const realUrl = ((_URL = new URL(req.url || '', target)) === null || _URL === void 0 ? void 0 : _URL.href) || '';
|
|
322
328
|
proxyRes.headers['x-real-url'] = realUrl;
|
|
323
|
-
(_proxyConfig$
|
|
329
|
+
(_proxyConfig$onProxyR2 = proxyConfig.onProxyRes) === null || _proxyConfig$onProxyR2 === void 0 ? void 0 : _proxyConfig$onProxyR2.call(proxyConfig, proxyRes, req, res);
|
|
324
330
|
}
|
|
325
331
|
|
|
326
332
|
}));
|
|
@@ -438,7 +444,7 @@ class Server {
|
|
|
438
444
|
port
|
|
439
445
|
});
|
|
440
446
|
return new Promise(resolve => {
|
|
441
|
-
_this.listeningApp.listen(foundPort, hostname,
|
|
447
|
+
_this.listeningApp.listen(foundPort, hostname, () => {
|
|
442
448
|
_this.createSocketServer();
|
|
443
449
|
|
|
444
450
|
const ret = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/server",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.34",
|
|
4
4
|
"description": "@umijs/server",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@umijs/core": "3.5.
|
|
28
|
-
"@umijs/deps": "3.5.
|
|
29
|
-
"@umijs/utils": "3.5.
|
|
27
|
+
"@umijs/core": "3.5.34",
|
|
28
|
+
"@umijs/deps": "3.5.34",
|
|
29
|
+
"@umijs/utils": "3.5.34"
|
|
30
30
|
}
|
|
31
31
|
}
|