@enfyra/sdk-nuxt 0.3.29 → 0.3.30
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/module.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../../src/runtime/utils/server/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,IAAI,CAAC;AAa3C,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../../src/runtime/utils/server/proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,IAAI,CAAC;AAa3C,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,4BAgC7D"}
|
|
@@ -16,7 +16,6 @@ export function proxyToAPI(event, customPath) {
|
|
|
16
16
|
const headers = event.context.proxyHeaders || {};
|
|
17
17
|
const isWebSocket = event.node.req.headers["upgrade"]?.toLowerCase() === "websocket";
|
|
18
18
|
if (isWebSocket) {
|
|
19
|
-
const originalUrl = event.node.req.url || "";
|
|
20
19
|
event.node.req.url = rawPath;
|
|
21
20
|
proxy.web(event.node.req, event.node.res, {
|
|
22
21
|
target: config.public?.enfyraSDK?.apiUrl || process.env.API_URL || "http://localhost:1105",
|
|
@@ -24,7 +23,6 @@ export function proxyToAPI(event, customPath) {
|
|
|
24
23
|
changeOrigin: true,
|
|
25
24
|
headers
|
|
26
25
|
});
|
|
27
|
-
event.node.req.url = originalUrl;
|
|
28
26
|
return void 0;
|
|
29
27
|
}
|
|
30
28
|
return proxyRequest(event, targetUrl, {
|
package/package.json
CHANGED
|
@@ -26,7 +26,7 @@ export function proxyToAPI(event: H3Event, customPath?: string) {
|
|
|
26
26
|
if (isWebSocket) {
|
|
27
27
|
// Modify req.url to remove the apiPrefix before proxying
|
|
28
28
|
// The incoming request is /api/chat/test-room but backend expects /chat/test-room
|
|
29
|
-
|
|
29
|
+
// Don't restore since proxy.web() is async
|
|
30
30
|
event.node.req.url = rawPath;
|
|
31
31
|
|
|
32
32
|
// For WebSocket, use http-proxy directly
|
|
@@ -36,9 +36,6 @@ export function proxyToAPI(event: H3Event, customPath?: string) {
|
|
|
36
36
|
changeOrigin: true,
|
|
37
37
|
headers,
|
|
38
38
|
});
|
|
39
|
-
|
|
40
|
-
// Restore original url
|
|
41
|
-
event.node.req.url = originalUrl;
|
|
42
39
|
// Return undefined to signal we've handled the response asynchronously
|
|
43
40
|
return undefined;
|
|
44
41
|
}
|