mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-09 14:58:47 +00:00
Allow widgets to add header or set methods
This commit is contained in:
parent
51ea4ea405
commit
d6448763e0
1 changed files with 2 additions and 2 deletions
|
@ -20,14 +20,14 @@ export default async function genericProxyHandler(req, res, map) {
|
|||
if (widget) {
|
||||
const url = new URL(formatApiCall(widgets[widget.type].api, { endpoint, ...widget }));
|
||||
|
||||
const headers = req.extraHeaders ?? {};
|
||||
const headers = req.extraHeaders ?? widget.headers ?? {};
|
||||
|
||||
if (widget.username && widget.password) {
|
||||
headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`;
|
||||
}
|
||||
|
||||
const params = {
|
||||
method: req.method,
|
||||
method: widget.method ?? req.method,
|
||||
headers,
|
||||
}
|
||||
if (req.body) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue