mirror of
https://github.com/gethomepage/homepage.git
synced 2025-07-09 03:04:18 -04:00
Change: preserve trailing slash in custom api calls (#5410)
This commit is contained in:
parent
a64c83209a
commit
6e16adc460
@ -19,9 +19,11 @@ export default async function genericProxyHandler(req, res, map) {
|
|||||||
|
|
||||||
if (widget) {
|
if (widget) {
|
||||||
// if there are more than one question marks, replace others to &
|
// if there are more than one question marks, replace others to &
|
||||||
const url = new URL(
|
let urlString = formatApiCall(widgets[widget.type].api, { endpoint, ...widget }).replace(/(?<=\?.*)\?/g, "&");
|
||||||
formatApiCall(widgets[widget.type].api, { endpoint, ...widget }).replace(/(?<=\?.*)\?/g, "&"),
|
if (widget.type === "customapi" && widget.url?.endsWith("/")) {
|
||||||
);
|
urlString += "/"; // Ensure we dont lose the trailing slash for custom API calls
|
||||||
|
}
|
||||||
|
const url = new URL(urlString);
|
||||||
|
|
||||||
const headers = req.extraHeaders ?? widget.headers ?? widgets[widget.type].headers ?? {};
|
const headers = req.extraHeaders ?? widget.headers ?? widgets[widget.type].headers ?? {};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user