Content-Typeの判定をゆるふわに

This commit is contained in:
ThinaticSystem 2022-06-19 04:25:28 +09:00
parent 16717567b7
commit 3fbfd1a145

View File

@ -66,10 +66,10 @@ export function createAiScriptEnv(opts) {
if (contentType === null) {
return utils.jsToVal(await response.text());
}
if (contentType.includes('application/json')) {
if (contentType.includes('json')) {
return utils.jsToVal(await response.json());
}
if (contentType.includes('application/xml') || contentType.includes('text/xml')) {
if (contentType.includes('xml')) {
const parser = new DOMParser();
return utils.jsToVal(parser.parseFromString((await response.text()), 'application/xml'));
}