import { RequestResult } from "https://deno.land/x/dax@0.34.0/src/request.ts";
Result of making a request.
Constructors
new
RequestResult(opts: { response: Response; originalUrl: string; progressBar: ProgressBar | undefined; })Methods
arrayBuffer(): Promise<ArrayBuffer>
Respose body as an array buffer.
Note: Returns undefined
when .noThrow(404)
and status code is 404.
json<TResult = any>(): Promise<TResult>
Respose body as JSON.
Note: Returns undefined
when .noThrow(404)
and status code is 404.
pipeThrough<T>(transform: { writable: WritableStream<Uint8Array>; readable: ReadableStream<T>; }): ReadableStream<T>
Pipes the response body through the provided transform.
pipeTo(dest: WritableStream<Uint8Array>, options?: PipeOptions): Promise<void>
Pipes the response body to the provided writable stream.
pipeToPath(path?: , options?: Deno.WriteFileOptions): Promise<PathRef>
Pipes the response body to a file.
text(): Promise<string>
Respose body as text.
Note: Returns undefined
when .noThrow(404)
and status code is 404.
throwIfNotOk(): void
Throws if the response doesn't have a 2xx code.
This might be useful if the request was built with .noThrow()
, but
otherwise this is called automatically for any non-2xx response codes.