Fix issue prevent adding urls via Chromium browsers.

Cette révision appartient à :
arabcoders
2025-05-28 15:59:28 +03:00
Parent bf8c0f3d44
révision 45bb4e2303
2 fichiers modifiés avec 11 ajouts et 5 suppressions
+3 -3
Voir le fichier
@@ -70,15 +70,15 @@ const sendRequest = async (path, data) => {
const url = new URL(instanceUrl);
url.pathname = path;
console.debug(`Sending to '${instanceUrl}'.`, data, headers.length > 0 ? 'with auth header' : 'without auth header');
let opts = {method: data.length > 0 ? 'POST' : 'GET', headers: headers};
let opts = {method: Object.keys(data).length > 0 ? 'POST' : 'GET', headers: headers};
if (data) {
opts.headers['Content-Type'] = 'application/json';
opts.body = JSON.stringify(data);
}
console.debug(`Sending to '${instanceUrl}'.`, opts, headers.length > 0 ? 'with auth header' : 'without auth header');
const req = await fetch(url, opts);
return {status: req.status, statusText: req.statusText, data: req};
};