Skip to content

basalt / drives/src / GuardedResponse

Interface: GuardedResponse ​

Defined in: drives/src/fetch.ts:81

Properties ​

body ​

> body: Readable

Defined in: drives/src/fetch.ts:87

The body as a stream. Consume it or call destroy(). Capped at maxBytes.


headers ​

> headers: Record<string, string>

Defined in: drives/src/fetch.ts:85

Lowercased response headers.


ok ​

> ok: boolean

Defined in: drives/src/fetch.ts:83


status ​

> status: number

Defined in: drives/src/fetch.ts:82

Methods ​

destroy() ​

> destroy(): void

Defined in: drives/src/fetch.ts:93

Abandons the body without reading it.

Returns ​

void


json() ​

> json<T>(): Promise<T>

Defined in: drives/src/fetch.ts:91

Reads the whole (capped) body and parses it as JSON.

Type Parameters ​

T ​

T = unknown

Returns ​

Promise<T>


text() ​

> text(): Promise<string>

Defined in: drives/src/fetch.ts:89

Reads the whole (capped) body as text.

Returns ​

Promise<string>

Released under the MIT License.