hermes-web-ui 0.1.0 → 0.1.1
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/bin/hermes-web-ui.mjs +7 -1
- package/package.json +2 -2
package/bin/hermes-web-ui.mjs
CHANGED
|
@@ -57,10 +57,16 @@ async function proxyRequest(req, res, reqPath) {
|
|
|
57
57
|
delete headers['referer']
|
|
58
58
|
|
|
59
59
|
try {
|
|
60
|
+
const hasBody = req.method !== 'GET' && req.method !== 'HEAD'
|
|
61
|
+
const bodyChunks = hasBody ? [] : null
|
|
62
|
+
if (hasBody) {
|
|
63
|
+
for await (const chunk of req) bodyChunks.push(chunk)
|
|
64
|
+
}
|
|
65
|
+
|
|
60
66
|
const apiRes = await fetch(url, {
|
|
61
67
|
method: req.method,
|
|
62
68
|
headers,
|
|
63
|
-
body:
|
|
69
|
+
body: bodyChunks ? Buffer.concat(bodyChunks) : undefined,
|
|
64
70
|
})
|
|
65
71
|
|
|
66
72
|
const resHeaders = {}
|