nest-graph-inspector 0.8.0-test.4 → 0.8.0
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.
|
@@ -60,7 +60,7 @@ let ProxyAdapter = class ProxyAdapter {
|
|
|
60
60
|
const requestModule = this.getRequestModule(targetUrl);
|
|
61
61
|
const proxyReq = requestModule.request(targetUrl, this.createProxyRequestOptions(clientReq, targetUrl), (proxyRes) => this.forwardResponse(cors, proxyRes, clientReq, clientRes));
|
|
62
62
|
proxyReq.on('error', (error) => {
|
|
63
|
-
this.handleProxyError(error, clientRes);
|
|
63
|
+
this.handleProxyError(error, cors, clientReq, clientRes);
|
|
64
64
|
});
|
|
65
65
|
clientReq.pipe(proxyReq);
|
|
66
66
|
}
|
|
@@ -91,11 +91,12 @@ let ProxyAdapter = class ProxyAdapter {
|
|
|
91
91
|
},
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
handleProxyError(error, res) {
|
|
94
|
+
handleProxyError(error, cors, req, res) {
|
|
95
95
|
if (res.headersSent) {
|
|
96
96
|
res.destroy(error);
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
+
this.applyCors(cors, req, res);
|
|
99
100
|
res.statusCode = 502;
|
|
100
101
|
res.end(`Proxy error: ${error.message}`);
|
|
101
102
|
}
|
|
@@ -94,17 +94,10 @@ let ViewerOutputAdapter = class ViewerOutputAdapter {
|
|
|
94
94
|
return { origin, path };
|
|
95
95
|
}
|
|
96
96
|
viewerCorsOptions() {
|
|
97
|
-
const viewerUrl = new URL(this.viewerBaseUrl);
|
|
98
|
-
const viewerOrigin = viewerUrl.origin;
|
|
99
97
|
return {
|
|
100
|
-
origins:
|
|
101
|
-
? [viewerOrigin, /^https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/]
|
|
102
|
-
: [viewerOrigin],
|
|
98
|
+
origins: [/.*/],
|
|
103
99
|
};
|
|
104
100
|
}
|
|
105
|
-
isLoopbackHost(hostname) {
|
|
106
|
-
return (hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '[::1]');
|
|
107
|
-
}
|
|
108
101
|
async writeHistoryFiles(dirPath, trace) {
|
|
109
102
|
const traceIndex = this.runtimeTraceRecorder
|
|
110
103
|
.getCompletedTraces()
|