SimpleChat: Rather need to use append to insert headers

This commit is contained in:
HanishKVC 2024-05-29 20:30:34 +05:30
parent dce4e6a64b
commit c9559d2b26

View file

@ -164,6 +164,12 @@ class SimpleChat {
return last;
}
/**
* Setup the fetch headers.
* It picks the headers from gMe.headers.
* It inserts Authorization only if its non-empty.
* @param {string} apiEP
*/
fetch_headers(apiEP) {
let headers = new Headers();
for(let k in gMe.headers) {
@ -171,7 +177,7 @@ class SimpleChat {
if ((k == "Authorization") && (v.trim() == "")) {
continue;
}
headers[k] = v;
headers.append(k, v);
}
return headers;
}