Skip to main content Link Search Menu Expand Document (external link)

HttpClientResponse overview

Added in v1.0.0


Table of contents


accessors

stream

Signature

export declare const stream: <E, R>(
  effect: Effect.Effect<HttpClientResponse, E, R>
) => Stream.Stream<Uint8Array, Error.ResponseError | E, Exclude<R, Scope.Scope>>

Added in v1.0.0

constructors

fromWeb

Signature

export declare const fromWeb: (request: ClientRequest.HttpClientRequest, source: Response) => HttpClientResponse

Added in v1.0.0

filters

filterStatus

Signature

export declare const filterStatus: {
  (f: (status: number) => boolean): (self: HttpClientResponse) => Effect.Effect<HttpClientResponse, Error.ResponseError>
  (self: HttpClientResponse, f: (status: number) => boolean): Effect.Effect<HttpClientResponse, Error.ResponseError>
}

Added in v1.0.0

filterStatusOk

Signature

export declare const filterStatusOk: (
  self: HttpClientResponse
) => Effect.Effect<HttpClientResponse, Error.ResponseError>

Added in v1.0.0

models

HttpClientResponse (interface)

Signature

export interface HttpClientResponse extends IncomingMessage.HttpIncomingMessage<Error.ResponseError> {
  readonly [TypeId]: TypeId
  readonly request: ClientRequest.HttpClientRequest
  readonly status: number
  readonly cookies: Cookies.Cookies
  readonly formData: Effect.Effect<FormData, Error.ResponseError>
}

Added in v1.0.0

pattern matching

matchStatus

Signature

export declare const matchStatus: {
  <
    const Cases extends {
      readonly [status: number]: (_: HttpClientResponse) => any
      readonly "2xx"?: (_: HttpClientResponse) => any
      readonly "3xx"?: (_: HttpClientResponse) => any
      readonly "4xx"?: (_: HttpClientResponse) => any
      readonly "5xx"?: (_: HttpClientResponse) => any
      readonly orElse: (_: HttpClientResponse) => any
    }
  >(
    cases: Cases
  ): (self: HttpClientResponse) => Cases[keyof Cases] extends (_: any) => infer R ? Unify<R> : never
  <
    const Cases extends {
      readonly [status: number]: (_: HttpClientResponse) => any
      readonly "2xx"?: (_: HttpClientResponse) => any
      readonly "3xx"?: (_: HttpClientResponse) => any
      readonly "4xx"?: (_: HttpClientResponse) => any
      readonly "5xx"?: (_: HttpClientResponse) => any
      readonly orElse: (_: HttpClientResponse) => any
    }
  >(
    self: HttpClientResponse,
    cases: Cases
  ): Cases[keyof Cases] extends (_: any) => infer R ? Unify<R> : never
}

Added in v1.0.0

schema

schemaBodyJson

Signature

export declare const schemaBodyJson: <A, I, R>(
  schema: Effect<A, I, R>,
  options?: Effect | undefined
) => <E>(self: IncomingMessage.HttpIncomingMessage<E>) => Effect<A, E | Effect, R>

Added in v1.0.0

schemaBodyUrlParams

Signature

export declare const schemaBodyUrlParams: <A, I extends Readonly<Record<string, string | undefined>>, R>(
  schema: Effect<A, I, R>,
  options?: Effect | undefined
) => <E>(self: IncomingMessage.HttpIncomingMessage<E>) => Effect<A, E | Effect, R>

Added in v1.0.0

schemaHeaders

Signature

export declare const schemaHeaders: <A, I extends Readonly<Record<string, string | undefined>>, R>(
  schema: Effect<A, I, R>,
  options?: Effect | undefined
) => <E>(self: IncomingMessage.HttpIncomingMessage<E>) => Effect<A, Effect, R>

Added in v1.0.0

schemaJson

Signature

export declare const schemaJson: <
  R,
  I extends {
    readonly status?: number | undefined
    readonly headers?: Readonly<Record<string, string>> | undefined
    readonly body?: unknown
  },
  A
>(
  schema: Schema.Schema<A, I, R>,
  options?: ParseOptions | undefined
) => (self: HttpClientResponse) => Effect.Effect<A, Error.ResponseError | ParseResult.ParseError, R>

Added in v1.0.0

schemaNoBody

Signature

export declare const schemaNoBody: <
  R,
  I extends { readonly status?: number | undefined; readonly headers?: Readonly<Record<string, string>> | undefined },
  A
>(
  schema: Schema.Schema<A, I, R>,
  options?: ParseOptions | undefined
) => (self: HttpClientResponse) => Effect.Effect<A, ParseResult.ParseError, R>

Added in v1.0.0

type ids

TypeId

Signature

export declare const TypeId: typeof TypeId

Added in v1.0.0

TypeId (type alias)

Signature

export type TypeId = typeof TypeId

Added in v1.0.0