Merge pull request #7287 from tchak/fix-bring-back-js-request
fix(js): bring back js request for now
This commit is contained in:
commit
a39ce92feb
1 changed files with 13 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue