HttpServerResponse overview
Added in v1.0.0
Table of contents
combinators
removeCookie
Signature
export declare const removeCookie: {
(name: string): (self: HttpServerResponse) => HttpServerResponse
(self: HttpServerResponse, name: string): HttpServerResponse
}
Added in v1.0.0
replaceCookies
Signature
export declare const replaceCookies: {
(cookies: Cookies): (self: HttpServerResponse) => HttpServerResponse
(self: HttpServerResponse, cookies: Cookies): HttpServerResponse
}
Added in v1.0.0
setBody
Signature
export declare const setBody: {
(body: Body.HttpBody): (self: HttpServerResponse) => HttpServerResponse
(self: HttpServerResponse, body: Body.HttpBody): HttpServerResponse
}
Added in v1.0.0
setCookie
Signature
export declare const setCookie: {
(
name: string,
value: string,
options?: Cookie["options"]
): (self: HttpServerResponse) => Effect.Effect<HttpServerResponse, CookiesError>
(
self: HttpServerResponse,
name: string,
value: string,
options?: Cookie["options"]
): Effect.Effect<HttpServerResponse, CookiesError>
}
Added in v1.0.0
setCookies
Signature
export declare const setCookies: {
(
cookies: Iterable<readonly [name: string, value: string, options?: Cookie["options"]]>
): (self: HttpServerResponse) => Effect.Effect<HttpServerResponse, CookiesError, never>
(
self: HttpServerResponse,
cookies: Iterable<readonly [name: string, value: string, options?: Cookie["options"]]>
): Effect.Effect<HttpServerResponse, CookiesError, never>
}
Added in v1.0.0
setHeader
Signature
export declare const setHeader: {
(key: string, value: string): (self: HttpServerResponse) => HttpServerResponse
(self: HttpServerResponse, key: string, value: string): HttpServerResponse
}
Added in v1.0.0
setHeaders
Signature
export declare const setHeaders: {
(input: Headers.Input): (self: HttpServerResponse) => HttpServerResponse
(self: HttpServerResponse, input: Headers.Input): HttpServerResponse
}
Added in v1.0.0
setStatus
Signature
export declare const setStatus: {
(status: number, statusText?: string | undefined): (self: HttpServerResponse) => HttpServerResponse
(self: HttpServerResponse, status: number, statusText?: string | undefined): HttpServerResponse
}
Added in v1.0.0
unsafeSetCookie
Signature
export declare const unsafeSetCookie: {
(name: string, value: string, options?: Cookie["options"]): (self: HttpServerResponse) => HttpServerResponse
(self: HttpServerResponse, name: string, value: string, options?: Cookie["options"]): HttpServerResponse
}
Added in v1.0.0
unsafeSetCookies
Signature
export declare const unsafeSetCookies: {
(
cookies: Iterable<readonly [name: string, value: string, options?: Cookie["options"]]>
): (self: HttpServerResponse) => HttpServerResponse
(
self: HttpServerResponse,
cookies: Iterable<readonly [name: string, value: string, options?: Cookie["options"]]>
): HttpServerResponse
}
Added in v1.0.0
updateCookies
Signature
export declare const updateCookies: {
(f: (cookies: Cookies) => Cookies): (self: HttpServerResponse) => HttpServerResponse
(self: HttpServerResponse, f: (cookies: Cookies) => Cookies): HttpServerResponse
}
Added in v1.0.0
constructors
empty
Signature
export declare const empty: (options?: Options.WithContent | undefined) => HttpServerResponse
Added in v1.0.0
file
Signature
export declare const file: (
path: string,
options?: (Options & FileSystem.StreamOptions) | undefined
) => Effect.Effect<HttpServerResponse, PlatformError.PlatformError, Platform.HttpPlatform>
Added in v1.0.0
fileWeb
Signature
export declare const fileWeb: (
file: Body.HttpBody.FileLike,
options?: (Options.WithContent & FileSystem.StreamOptions) | undefined
) => Effect.Effect<HttpServerResponse, never, Platform.HttpPlatform>
Added in v1.0.0
formData
Signature
export declare const formData: (body: FormData, options?: Options.WithContent | undefined) => HttpServerResponse
Added in v1.0.0
html
Signature
export declare const html: {
<A extends ReadonlyArray<Template.Interpolated>>(
strings: TemplateStringsArray,
...args: A
): Effect.Effect<HttpServerResponse, Template.Interpolated.Error<A[number]>, Template.Interpolated.Context<A[number]>>
(html: string): HttpServerResponse
}
Added in v1.0.0
htmlStream
Signature
export declare const htmlStream: <A extends ReadonlyArray<Template.InterpolatedWithStream>>(
strings: TemplateStringsArray,
...args: A
) => Effect.Effect<HttpServerResponse, never, Template.Interpolated.Context<A[number]>>
Added in v1.0.0
json
Signature
export declare const json: (
body: unknown,
options?: Options.WithContentType | undefined
) => Effect.Effect<HttpServerResponse, Body.HttpBodyError>
Added in v1.0.0
raw
Signature
export declare const raw: (body: unknown, options?: Options | undefined) => HttpServerResponse
Added in v1.0.0
redirect
Signature
export declare const redirect: (
location: string | URL,
options?: Options.WithContentType | undefined
) => HttpServerResponse
Added in v1.0.0
schemaJson
Signature
export declare const schemaJson: <A, I, R>(
schema: Schema.Schema<A, I, R>,
options?: ParseOptions | undefined
) => (body: A, options?: Options.WithContent | undefined) => Effect.Effect<HttpServerResponse, Body.HttpBodyError, R>
Added in v1.0.0
stream
Signature
export declare const stream: <E>(
body: Stream.Stream<Uint8Array, E, never>,
options?: Options | undefined
) => HttpServerResponse
Added in v1.0.0
text
Signature
export declare const text: (body: string, options?: Options.WithContentType | undefined) => HttpServerResponse
Added in v1.0.0
uint8Array
Signature
export declare const uint8Array: (body: Uint8Array, options?: Options.WithContentType | undefined) => HttpServerResponse
Added in v1.0.0
unsafeJson
Signature
export declare const unsafeJson: (body: unknown, options?: Options.WithContentType | undefined) => HttpServerResponse
Added in v1.0.0
urlParams
Signature
export declare const urlParams: (
body: UrlParams.Input,
options?: Options.WithContentType | undefined
) => HttpServerResponse
Added in v1.0.0
conversions
toWeb
Signature
export declare const toWeb: (
response: HttpServerResponse,
options?: { readonly withoutBody?: boolean | undefined; readonly runtime?: Runtime.Runtime<never> | undefined }
) => Response
Added in v1.0.0
models
HttpServerResponse (interface)
Signature
export interface HttpServerResponse extends Effect.Effect<HttpServerResponse>, Inspectable, Respondable {
readonly [TypeId]: TypeId
readonly status: number
readonly statusText?: string | undefined
readonly headers: Headers.Headers
readonly cookies: Cookies
readonly body: Body.HttpBody
}
Added in v1.0.0
Options (interface)
Signature
export interface Options {
readonly status?: number | undefined
readonly statusText?: string | undefined
readonly headers?: Headers.Input | undefined
readonly cookies?: Cookies | undefined
readonly contentType?: string | undefined
readonly contentLength?: number | undefined
}
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 HttpServerResponse
Added in v1.0.0