ServerResponse overview
Added in v1.0.0
Table of contents
combinators
setBody
Signature
export declare const setBody: {
(body: Body.Body): (self: ServerResponse) => ServerResponse
(self: ServerResponse, body: Body.Body): ServerResponse
}
Added in v1.0.0
setHeader
Signature
export declare const setHeader: {
(key: string, value: string): (self: ServerResponse) => ServerResponse
(self: ServerResponse, key: string, value: string): ServerResponse
}
Added in v1.0.0
setHeaders
Signature
export declare const setHeaders: {
(input: Headers.Input): (self: ServerResponse) => ServerResponse
(self: ServerResponse, input: Headers.Input): ServerResponse
}
Added in v1.0.0
setStatus
Signature
export declare const setStatus: {
(status: number, statusText?: string | undefined): (self: ServerResponse) => ServerResponse
(self: ServerResponse, status: number, statusText?: string | undefined): ServerResponse
}
Added in v1.0.0
constructors
empty
Signature
export declare const empty: (options?: Options.WithContent) => ServerResponse
Added in v1.0.0
file
Signature
export declare const file: (
path: string,
options?: Options & FileSystem.StreamOptions
) => Effect.Effect<Platform.Platform, PlatformError.PlatformError, ServerResponse>
Added in v1.0.0
fileWeb
Signature
export declare const fileWeb: (
file: Body.Body.FileLike,
options?: Options.WithContent & FileSystem.StreamOptions
) => Effect.Effect<Platform.Platform, never, ServerResponse>
Added in v1.0.0
formData
Signature
export declare const formData: (body: FormData, options?: Options.WithContent) => ServerResponse
Added in v1.0.0
json
Signature
export declare const json: (
body: unknown,
options?: Options.WithContent
) => Effect.Effect<never, Body.BodyError, ServerResponse>
Added in v1.0.0
raw
Signature
export declare const raw: (body: unknown, options?: Options) => ServerResponse
Added in v1.0.0
schemaJson
Signature
export declare const schemaJson: <I, A>(
schema: Schema.Schema<I, A>
) => (body: A, options?: Options.WithContent) => Effect.Effect<never, Body.BodyError, ServerResponse>
Added in v1.0.0
stream
Signature
export declare const stream: (body: Stream.Stream<never, unknown, Uint8Array>, options?: Options) => ServerResponse
Added in v1.0.0
text
Signature
export declare const text: (body: string, options?: Options.WithContentType) => ServerResponse
Added in v1.0.0
uint8Array
Signature
export declare const uint8Array: (body: Uint8Array, options?: Options.WithContentType) => ServerResponse
Added in v1.0.0
unsafeJson
Signature
export declare const unsafeJson: (body: unknown, options?: Options.WithContent) => ServerResponse
Added in v1.0.0
urlParams
Signature
export declare const urlParams: (body: UrlParams.Input, options?: Options.WithContent) => ServerResponse
Added in v1.0.0
conversions
toWeb
Signature
export declare const toWeb: (response: ServerResponse, withoutBody?: boolean) => Response
Added in v1.0.0
models
Options (interface)
Signature
export interface Options {
readonly status?: number
readonly statusText?: string
readonly headers?: Headers.Headers
readonly contentType?: string
readonly contentLength?: number
}
Added in v1.0.0
ServerResponse (interface)
Signature
export interface ServerResponse extends Effect.Effect<never, never, ServerResponse> {
readonly [TypeId]: TypeId
readonly status: number
readonly statusText?: string
readonly headers: Headers.Headers
readonly body: Body.Body
}
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
utils
Options (namespace)
Added in v1.0.0
WithContent (interface)
Signature
export interface WithContent extends Omit<Options, "contentType" | "contentLength"> {}
Added in v1.0.0
WithContentType (interface)
Signature
export interface WithContentType extends Omit<Options, "contentLength"> {}
Added in v1.0.0
isServerResponse
Signature
export declare const isServerResponse: (u: unknown) => u is ServerResponse
Added in v1.0.0