Skip to content

HttpServerRequest

24 exports Added in v1.0.0 Source

Accessors

Signature

declare const persistedMultipart: Effect.Effect<
  unknown,
  Multipart.MultipartError,
  Scope.Scope | FileSystem.FileSystem | Path.Path | HttpServerRequest
>;

upgrade

Added in v1.0.0 Source

Signature

declare const upgrade: Effect.Effect<Socket.Socket, Error.RequestError, HttpServerRequest>;

Signature

declare const upgradeChannel: <IE = never>() => Channel<
  Chunk<Uint8Array>,
  Chunk<Uint8Array | string | Socket.CloseEvent>,
  Error.RequestError | IE | Socket.SocketError,
  IE,
  void,
  unknown,
  HttpServerRequest
>;

Context

Signature

declare const HttpServerRequest: Tag<HttpServerRequest, HttpServerRequest>;

Conversions

fromWeb

Added in v1.0.0 Source

Signature

declare const fromWeb: (request: Request) => HttpServerRequest;

toURL

Added in v1.0.0 Source

Signature

declare const toURL: (self: HttpServerRequest) => Option.Option<URL>;

toWeb

Added in v1.0.0 Source

Signature

declare function toWeb(
  self: HttpServerRequest,
  options?: {
    readonly signal?: AbortSignal;
  },
): Effect<Request, RequestError>;

toWebEither

Added in v1.0.0 Source

Signature

declare function toWebEither(
  self: HttpServerRequest,
  options?: {
    readonly runtime?: any;
    readonly signal?: AbortSignal;
  },
): Either<Request, RequestError>;

Fiber Refs

MaxBodySize

Added in v1.0.0 Source

Signature

declare class MaxBodySize extends any {
  constructor();
}

Signature

declare const withMaxBodySize: (size: Option<SizeInput>) => <A, E, R>(effect: Effect<A, E, R>) => Effect<A, E, R> & <A, E, R>(effect: Effect<A, E, R>, size: Option<SizeInput>) => Effect<A, E, R>

Models

HttpServerRequest interface

Added in v1.0.0 Source

Signature

interface HttpServerRequest extends HttpIncomingMessage<Error.RequestError> {
  readonly [TypeId]: typeof TypeId;
  readonly cookies: ReadonlyRecord<string, string>;
  readonly method: HttpMethod;
  readonly modify: (options: {
    readonly headers?: Headers;
    readonly remoteAddress?: string;
    readonly url?: string;
  }) => HttpServerRequest;
  readonly multipart: Effect<Persisted, MultipartError, Scope | FileSystem | Path>;
  readonly multipartStream: Stream<Part, MultipartError>;
  readonly originalUrl: string;
  readonly source: unknown;
  readonly upgrade: Effect<Socket, RequestError>;
  readonly url: string;
}

Schema

Signature

declare const schemaBodyForm: <A, I extends Partial<Multipart.Persisted>, R>(
  schema: Schema.Schema<A, I, R>,
  options?: ParseOptions,
) => Effect.Effect<
  A,
  Multipart.MultipartError | ParseResult.ParseError | Error.RequestError,
  R | HttpServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path
>;

Signature

declare const schemaBodyFormJson: <A, I, R>(
  schema: Schema.Schema<A, I, R>,
  options?: ParseOptions,
) => (
  field: string,
) => Effect.Effect<
  A,
  ParseResult.ParseError | Error.RequestError,
  R | HttpServerRequest | FileSystem.FileSystem | Path.Path | Scope.Scope
>;

Signature

declare const schemaBodyJson: <A, I, R>(
  schema: Schema.Schema<A, I, R>,
  options?: ParseOptions,
) => Effect.Effect<A, Error.RequestError | ParseResult.ParseError, HttpServerRequest | R>;

Signature

declare const schemaBodyMultipart: <A, I extends Partial<Multipart.Persisted>, R>(
  schema: Schema.Schema<A, I, R>,
  options?: ParseOptions,
) => Effect.Effect<
  A,
  Multipart.MultipartError | ParseResult.ParseError,
  R | HttpServerRequest | Scope.Scope | FileSystem.FileSystem | Path.Path
>;

Signature

declare const schemaBodyUrlParams: <
  A,
  I extends Readonly<Record<string, string | ReadonlyArray<string> | undefined>>,
  R,
>(
  schema: Schema.Schema<A, I, R>,
  options?: ParseOptions,
) => Effect.Effect<A, ParseResult.ParseError | Error.RequestError, R | HttpServerRequest>;

Signature

declare const schemaCookies: <A, I extends Readonly<Record<string, string | undefined>>, R>(
  schema: Schema.Schema<A, I, R>,
  options?: ParseOptions,
) => Effect.Effect<A, ParseResult.ParseError, HttpServerRequest | R>;

Signature

declare const schemaHeaders: <A, I extends Readonly<Record<string, string | undefined>>, R>(
  schema: Schema.Schema<A, I, R>,
  options?: ParseOptions,
) => Effect.Effect<A, ParseResult.ParseError, HttpServerRequest | R>;

Signature

declare const schemaSearchParams: <
  A,
  I extends Readonly<Record<string, string | ReadonlyArray<string> | undefined>>,
  R,
>(
  schema: Schema.Schema<A, I, R>,
  options?: ParseOptions,
) => Effect.Effect<A, ParseResult.ParseError, ParsedSearchParams | R>;

Search Params

Signature

declare const ParsedSearchParams: Tag<
  ParsedSearchParams,
  ReadonlyRecord<string, string | Array<string>>
>;

ParsedSearchParams interface

Added in v1.0.0 Source

Signature

interface ParsedSearchParams {
  readonly _: typeof _;
}

Signature

declare const searchParamsFromURL: (url: URL) => ReadonlyRecord<string, string | Array<string>>;

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;