fix(js): bring back js request for now

This commit is contained in:
Paul Chavard 2022-05-11 09:34:19 +02:00
parent 866c4acaf9
commit 531464fab1

View file

@ -181,6 +181,19 @@ export function httpRequest(
const stream = await response.text();
session.renderStreamMessage(stream);
}
},
async js(): Promise<void> {
const response = await request(init, 'text/javascript');
if (response.status != 204) {
const script = document.createElement('script');
const nonce = cspNonce();
if (nonce) {
script.setAttribute('nonce', nonce);
}
script.text = await response.text();
document.head.appendChild(script);
document.head.removeChild(script);
}
}
};
}