Content-Typeの判定をゆるふわに
This commit is contained in:
parent
16717567b7
commit
3fbfd1a145
@ -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'));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user