Support fetching text

This commit is contained in:
RMidhunSuresh 2022-07-15 15:04:54 +05:30
parent f7b302d34f
commit d731eab51c

View file

@ -115,6 +115,9 @@ export function createFetchRequest(createTimeout, serviceWorkerHandler) {
} else if (format === "buffer") { } else if (format === "buffer") {
body = await response.arrayBuffer(); body = await response.arrayBuffer();
} }
else if (format === "text") {
body = await response.text();
}
} catch (err) { } catch (err) {
// some error pages return html instead of json, ignore error // some error pages return html instead of json, ignore error
if (!(err.name === "SyntaxError" && status >= 400)) { if (!(err.name === "SyntaxError" && status >= 400)) {