From 53149df5f17948bd3ea4499aa606cfe0de41e11f Mon Sep 17 00:00:00 2001 From: Ben Phelps Date: Sun, 11 Sep 2022 14:30:28 +0300 Subject: [PATCH] handle proxy methods other than GET --- src/utils/proxies/credentialed.js | 1 + src/utils/proxies/generic.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils/proxies/credentialed.js b/src/utils/proxies/credentialed.js index a0bd799f7..6b4cbf0ab 100644 --- a/src/utils/proxies/credentialed.js +++ b/src/utils/proxies/credentialed.js @@ -11,6 +11,7 @@ export default async function credentialedProxyHandler(req, res) { if (widget) { const url = new URL(formatApiCall(widget.type, { endpoint, ...widget })); const [status, contentType, data] = await httpProxy(url, { + method: req.method, withCredentials: true, credentials: "include", headers: { diff --git a/src/utils/proxies/generic.js b/src/utils/proxies/generic.js index 83a710f53..83dfeca1b 100644 --- a/src/utils/proxies/generic.js +++ b/src/utils/proxies/generic.js @@ -10,7 +10,9 @@ export default async function genericProxyHandler(req, res) { if (widget) { const url = new URL(formatApiCall(widget.type, { endpoint, ...widget })); - const [status, contentType, data] = await httpProxy(url); + const [status, contentType, data] = await httpProxy(url, { + method: req.method, + }); if (contentType) res.setHeader("Content-Type", contentType);