cwresdev 0.1.8 → 0.1.9
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/package.json +1 -1
- package/src/proxy.js +12 -2
package/package.json
CHANGED
package/src/proxy.js
CHANGED
|
@@ -91,12 +91,22 @@ async function proxyRequest({ req, res, target, injectHtml = false, injectCookie
|
|
|
91
91
|
outHeaders.cookie = _stagingCookie;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
const
|
|
94
|
+
const fetchOpts = {
|
|
95
95
|
method: req.method,
|
|
96
96
|
headers: outHeaders,
|
|
97
97
|
body,
|
|
98
98
|
redirect: "manual",
|
|
99
|
-
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
let upstream;
|
|
102
|
+
|
|
103
|
+
try {
|
|
104
|
+
upstream = await fetch(target, fetchOpts);
|
|
105
|
+
} catch (err) {
|
|
106
|
+
// Retry once – works around a transient Node.js v24 undici parser bug
|
|
107
|
+
// (ERR_ASSERTION in Parser.finish) that can reject the fetch promise.
|
|
108
|
+
upstream = await fetch(target, fetchOpts);
|
|
109
|
+
}
|
|
100
110
|
|
|
101
111
|
res.status(upstream.status);
|
|
102
112
|
|