handle proxy methods other than GET

This commit is contained in:
Ben Phelps 2022-09-11 14:30:28 +03:00
parent bc2025b3ba
commit 53149df5f1
2 changed files with 4 additions and 1 deletions

View File

@ -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: {

View File

@ -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);