Options
All
  • Public
  • Public/Protected
  • All
Menu

Package http

@typed/http

Cross-platform HTTP requests with superpowers.

Index

Type aliases

GetOptions

GetOptions: Readonly<Partial<MergeObjects<DropKeys<HttpOptions, "body">, { queryParameters?: Record<string, string | undefined> }>>>

HttpCallbacks

HttpCallbacks: { failure: (error: Error) => Disposable; success: (response: HttpResponse) => Disposable }

Type declaration

  • Readonly failure: (error: Error) => Disposable
      • (error: Error): Disposable
      • Parameters

        Returns Disposable

  • Readonly success: (response: HttpResponse) => Disposable

HttpHeaders

HttpHeaders: Readonly<Record<string, string | undefined>>

HttpMethod

HttpMethod: "GET" | "POST" | "PUT" | "DELETE" | "OPTIONS" | "PATCH" | "HEAD"

HttpOptions

HttpOptions: { body?: undefined | string; headers?: HttpHeaders; method?: HttpMethod }

Type declaration

  • Optional Readonly body?: undefined | string
  • Optional Readonly headers?: HttpHeaders
  • Optional Readonly method?: HttpMethod

HttpRequestValue

HttpRequestValue<A>: A extends HttpRequest<infer R> ? R : never

Type parameters

  • A

HttpResponse

HttpResponse<A>: { headers: HttpHeaders; responseText: string; status: number; statusText: string }

Type parameters

  • A

Type declaration

  • Readonly headers: HttpHeaders
  • Readonly responseText: string
  • Readonly status: number
  • Readonly statusText: string

Json

JsonPrimitive

JsonPrimitive: string | number | boolean | null

WithHttpManagementOptions

WithHttpManagementOptions: { expiration?: undefined | number; getCacheKey?: undefined | ((url: string, options: HttpOptions) => string); methodsToCache?: HttpMethod[]; timer: Timer }

Type declaration

  • Optional Readonly expiration?: undefined | number
  • Optional Readonly getCacheKey?: undefined | ((url: string, options: HttpOptions) => string)
  • Optional Readonly methodsToCache?: HttpMethod[]
  • Readonly timer: Timer

Variables

Const addAuthorizationHeader

addAuthorizationHeader: Curry2<string, HttpEnv, HttpEnv> = addHeader('Authorization')

Const addHeader

addHeader: Curry3<string, string, HttpEnv, HttpEnv> = curry((name: string, value: string, { http }: HttpEnv): HttpEnv => {return {http: (url, options, callbacks) =>http(url, { ...options, headers: { ...options.headers, [name]: value } }, callbacks),}},)

Const withHttpManagement

withHttpManagement: { (options: WithHttpManagementOptions, env: HttpEnv): HttpEnv; (options: WithHttpManagementOptions): (env: HttpEnv) => HttpEnv } = curry(__withHttpManagement)

Type declaration

Functions

createFailedResponse

createFetchHttpEnv

createHttpEnv

createHttpResponse

createJsonResponse

createServerHttpEnv

createSuccessfulResponse

  • createSuccessfulResponse<A>(options?: Partial<HttpResponse<A>>): Right<{ headers: HttpHeaders; responseText: string; status: number; statusText: string }>

createTestHttpEnv

Const get

http

isValidStatus

  • isValidStatus(__namedParameters: { status: number }): boolean

toJson

Generated using TypeDoc