index overview
Added in v0.1.0
Table of contents
combinators
setBody
Signature
export declare const setBody: (body: string, contentType: string) => (request: Request) => Request
Added in v0.1.2
setHeader
Signature
export declare const setHeader: (key: string, value: string) => (request: Request) => Request
Added in v0.1.1
setHeaders
Signature
export declare const setHeaders: (headers: Record<string, string>) => (request: Request) => Request
Added in v0.1.1
constructors
Request
Signature
export declare const Request: (method: string) => (url: string | { href: string }) => Request
Added in v0.1.0
send
Signature
export declare const send: (request: Request) => ReaderTaskEither<FetchEnv, Error, Response>
Added in v0.1.0
model
Fetch (type alias)
Signature
export type Fetch = (...args: Request) => Promise<Response>
Added in v0.1.0
FetchEnv (interface)
Signature
export interface FetchEnv {
fetch: Fetch
}
Added in v0.1.0
Request (type alias)
Signature
export type Request = [url: string, init: RequestInit]
Added in v0.1.0
Response (interface)
Signature
export interface Response<S extends number = number> {
readonly headers: Headers
readonly status: S
readonly statusText: string
readonly url: string
clone(): Response<S>
text(): Promise<string>
}
Added in v0.1.0
refinements
hasStatus
Signature
export declare const hasStatus: <S extends number>(...status: readonly S[]) => Refinement<Response<number>, Response<S>>
Added in v0.1.1
utils
decode
Signature
export declare const decode: <A>(
decoder: D.Decoder<string, A>
) => (response: Response) => TE.TaskEither<FreeSemigroup<DecodeError<string>>, A>
Added in v0.1.3
getText
Signature
export declare const getText: <E>(onError: (reason: unknown) => E) => (response: Response) => TE.TaskEither<E, string>
Added in v0.1.1