Enhancement: Add requestBody param for customapi (#2921)

This commit is contained in:
Derek Stotz 2024-02-16 22:25:31 -06:00 committed by GitHub
parent 0d47dcaac7
commit c268739e1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View file

@ -35,6 +35,12 @@ export default async function genericProxyHandler(req, res, map) {
};
if (req.body) {
params.body = req.body;
} else if (widget.requestBody) {
if (typeof widget.requestBody === "object") {
params.body = JSON.stringify(widget.requestBody);
} else {
params.body = widget.requestBody;
}
}
const [status, contentType, data] = await httpProxy(url, params);