forcing update when querying the terms, and fixing bug in request header parsing

This commit is contained in:
Sebastian 2022-01-16 18:37:36 -03:00
parent bc817a638d
commit ac60a0559c
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
2 changed files with 4 additions and 14 deletions

View File

@ -441,6 +441,7 @@ async function getExchangeTos(
ws,
exchangeBaseUrl,
acceptedFormat,
true,
);
const content = exchangeDetails.termsOfServiceText;
const currentEtag = exchangeDetails.termsOfServiceLastEtag;

View File

@ -45,8 +45,9 @@ export class ServiceWorkerHttpLib implements HttpRequestLibrary {
})
const headerMap = new Headers();
response.headers.forEach(addLineToMap(headerMap));
response.headers.forEach((value, key) => {
headerMap.set(key, value);
})
return {
headers: headerMap,
status: response.status,
@ -132,15 +133,3 @@ function makeJsonHandler(response: Response, requestUrl: string) {
}
}
function addLineToMap(map: { set(k: string, v: string): void }) {
return (line: string) => {
const parts = line.split(": ");
const headerName = parts.shift();
if (!headerName) {
logger.warn("skipping invalid header");
return;
}
const value = parts.join(": ");
map.set(headerName, value);
}
}