| /** | |
| * Common model for incoming HTTP messages. | |
| * | |
| * `HttpIncomingMessage` is used by server requests and client responses to | |
| * expose headers, an optional remote address, and body accessors. This module | |
| * provides decoders for JSON bodies, URL-encoded bodies, and headers, plus the | |
| * shared body-size setting and inspection helper used by request and response | |
| * implementations. | |
| * | |
| * @since 4.0.0 | |
| */ | |
| import * as Context from "../../Context.ts"; | |
| import * as Effect from "../../Effect.ts"; | |
| import type * as FileSystem from "../../FileSystem.ts"; | |
| import type * as Inspectable from "../../Inspectable.ts"; | |
| import type * as Option from "../../Option.ts"; | |
| import * as Schema from "../../Schema.ts"; | |
| import type { ParseOptions } from "../../SchemaAST.ts"; | |
| import type * as Stream from "../../Stream.ts"; | |
| import type * as Headers from "./Headers.ts"; | |
| import * as UrlParams from "./UrlParams.ts"; | |
| /** | |
| * Type identifier for `HttpIncomingMessage` values. | |
| * | |
| * @category type IDs | |
| * @since 4.0.0 | |
| */ | |
| export declare const TypeId = "~effect/http/HttpIncomingMessage"; | |
| /** | |
| * Returns `true` when a value is an `HttpIncomingMessage`. | |
| * | |
| * @category guards | |
| * @since 4.0.0 | |
| */ | |
| export declare const isHttpIncomingMessage: (u: unknown) => u is HttpIncomingMessage; | |
| /** | |
| * Common model for incoming HTTP messages, with headers, remote address, and effectful body accessors. | |
| * | |
| * @category models | |
| * @since 4.0.0 | |
| */ | |
| export interface HttpIncomingMessage<E = unknown> extends Inspectable.Inspectable { | |
| readonly [TypeId]: typeof TypeId; | |
| readonly headers: Headers.Headers; | |
| readonly remoteAddress: Option.Option<string>; | |
| readonly json: Effect.Effect<Schema.Json, E>; | |
| readonly text: Effect.Effect<string, E>; | |
| readonly urlParamsBody: Effect.Effect<UrlParams.UrlParams, E>; | |
| readonly arrayBuffer: Effect.Effect<ArrayBuffer, E>; | |
| readonly stream: Stream.Stream<Uint8Array, E>; | |
| } | |
| /** | |
| * Creates a decoder that reads an incoming message's JSON body and decodes it with the supplied schema. | |
| * | |
| * @category schemas | |
| * @since 4.0.0 | |
| */ | |
| export declare const schemaBodyJson: <S extends Schema.Top>(schema: S, options?: ParseOptions | undefined) => <E>(self: HttpIncomingMessage<E>) => Effect.Effect<S["Type"], E | Schema.SchemaError, S["DecodingServices"]>; | |
| /** | |
| * Creates a decoder that reads an incoming message's URL-encoded body parameters and decodes them with the supplied schema. | |
| * | |
| * @category schemas | |
| * @since 4.0.0 | |
| */ | |
| export declare const schemaBodyUrlParams: <A, I extends Readonly<Record<string, string | ReadonlyArray<string> | undefined>>, RD, RE>(schema: Schema.Codec<A, I, RD, RE>, options?: ParseOptions | undefined) => <E>(self: HttpIncomingMessage<E>) => Effect.Effect<A, E | Schema.SchemaError, RD>; | |
| /** | |
| * Creates a decoder that validates and decodes an incoming message's headers with the supplied schema. | |
| * | |
| * @category schemas | |
| * @since 4.0.0 | |
| */ | |
| export declare const schemaHeaders: <A, I extends Readonly<Record<string, string | undefined>>, RD, RE>(schema: Schema.Codec<A, I, RD, RE>, options?: ParseOptions | undefined) => <E>(self: HttpIncomingMessage<E>) => Effect.Effect<A, Schema.SchemaError, RD>; | |
| /** | |
| * Context reference for the optional maximum size allowed when reading an incoming message body. | |
| * | |
| * @category references | |
| * @since 4.0.0 | |
| */ | |
| export declare const MaxBodySize: Context.Reference<FileSystem.Size | undefined>; | |
| /** | |
| * Builds an inspectable object for an incoming message, redacting headers and including a synchronously readable JSON or text body when available. | |
| * | |
| * @category converting | |
| * @since 4.0.0 | |
| */ | |
| export declare const inspect: <E>(self: HttpIncomingMessage<E>, that: object) => object; | |
| //# sourceMappingURL=HttpIncomingMessage.d.ts.map |
Xet Storage Details
- Size:
- 3.71 kB
- Xet hash:
- c451c14d63c56dad2c9d7e2073049aa7a280d5d0b659e88182cedb8092ead7b9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.