remove parsing function
This commit is contained in:
parent
b7f2b6c322
commit
20c0b2bedf
@ -49,20 +49,6 @@ export function createAiScriptEnv(opts) {
|
||||
return await fetch(resource.value);
|
||||
}
|
||||
})();
|
||||
|
||||
// Parsing Section
|
||||
const contentType = response.headers.get('Content-Type');
|
||||
if (contentType === null) {
|
||||
return utils.jsToVal(await response.text());
|
||||
}
|
||||
if (contentType.includes('json')) {
|
||||
return utils.jsToVal(await response.json());
|
||||
}
|
||||
if (contentType.includes('xml')) {
|
||||
const parser = new DOMParser();
|
||||
return utils.jsToVal(parser.parseFromString((await response.text()), 'application/xml'));
|
||||
}
|
||||
// Content-Type不明
|
||||
return utils.jsToVal(await response.text());
|
||||
}),
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user