fix(js): prevent old Edge from crashing

This commit is contained in:
Paul Chavard 2022-05-05 09:35:53 +02:00
parent 998105b11f
commit 4307445999

View file

@ -138,7 +138,7 @@ export function httpRequest(
controller?: AbortController;
} = {}
) {
const headers = new Headers(init.headers);
const headers = init.headers ? new Headers(init.headers) : new Headers();
if (csrf) {
headers.set('x-csrf-token', csrfToken() ?? '');
headers.set('x-requested-with', 'XMLHttpRequest');