Skip to content

HttpClientResponse

13 exports Added in v1.0.0 Source

Accessors

stream

Added in v1.0.0 Source

Signature

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

Constructors

fromWeb

Added in v1.0.0 Source

Signature

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

Filters

filterStatus

Added in v1.0.0 Source

Signature

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

Signature

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

Models

HttpClientResponse interface

Added in v1.0.0 Source

Signature

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

Pattern Matching

matchStatus

Added in v1.0.0 Source

Signature

declare const matchStatus: {
  <
    Cases extends {
      [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) => R ? Unify<R> : never;
  <
    Cases extends {
      [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) => R ? Unify<R> : never;
};

Schema

Signature

declare function schemaBodyJson<A, I, R>(
  schema: any,
  options?: ParseOptions,
): <E>(self: HttpIncomingMessage<E>) => Effect<A, any, R>;

Signature

declare function schemaBodyUrlParams<A, I extends Readonly<Record<string, string | readonly Array<string> | undefined>>, R>(schema: any, options?: ParseOptions): <E>(self: HttpIncomingMessage<E>) => Effect<A, any, R>

Signature

declare function schemaHeaders<A, I extends Readonly<Record<string, string | undefined>>, R>(
  schema: any,
  options?: ParseOptions,
): <E>(self: HttpIncomingMessage<E>) => Effect<A, ParseError, R>;

schemaJson

Added in v1.0.0 Source

Signature

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

schemaNoBody

Added in v1.0.0 Source

Signature

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

Type Ids

TypeId

Added in v1.0.0 Source

Signature

declare const TypeId: unique symbol;

TypeId type

Added in v1.0.0 Source

Signature

type TypeId = typeof TypeId;