Utilities for Response.
npm install --save extra-response
# or
yarn add extra-response
ok(res: Response): Promise<Response>
If res.ok
is false
, it will throw HTTPError
.
toJSON(res: Response): Promise<Json>
toText(res: Response, charset?: string): Promise<string>
toLines(res: Response): AsyncIterable<string>
Only available on browser, because node-fetch
is not provide the WHATWG ReadableStream
as body.
toNDJSON(res: Response): AsyncIterable<Json>
Only available on browser, because node-fetch
is not provide the WHATWG ReadableStream
as body.