Skip to main content
Version: 0.1.1

Interface: FetchResponse

Imported from @react-logic/utils

Minimal Response-like surface that fetchState's parse function consumes. Both the native fetch Response and a custom adapter (e.g. the axios one in this package) need to expose this shape.

Properties​

ok​

readonly ok: boolean

True when status is in the 200-299 range.


status​

readonly status: number

HTTP status code.

Methods​

json()​

json(): Promise<unknown>

Parse body as JSON. Defaults to unknown — narrow with parse.

Returns​

Promise<unknown>


text()​

text(): Promise<string>

Parse body as text.

Returns​

Promise<string>