HttpServerResponse
Combinators
expireCookie
Added in v1.0.0
Source
Signature
declare const expireCookie: {
(
name: string,
options?: Omit<
| {
readonly domain?: string;
readonly expires?: Date;
readonly httpOnly?: boolean;
readonly maxAge?: Duration.DurationInput;
readonly partitioned?: boolean;
readonly path?: string;
readonly priority?: "low" | "medium" | "high";
readonly sameSite?: "lax" | "strict" | "none";
readonly secure?: boolean;
}
| undefined,
"expires" | "maxAge"
>,
): (self: HttpServerResponse) => HttpServerResponse;
(
self: HttpServerResponse,
name: string,
options?: Omit<
| {
readonly domain?: string;
readonly expires?: Date;
readonly httpOnly?: boolean;
readonly maxAge?: Duration.DurationInput;
readonly partitioned?: boolean;
readonly path?: string;
readonly priority?: "low" | "medium" | "high";
readonly sameSite?: "lax" | "strict" | "none";
readonly secure?: boolean;
}
| undefined,
"expires" | "maxAge"
>,
): HttpServerResponse;
};mergeCookies
Added in v1.0.0
Source
Signature
declare const mergeCookies: {
(cookies: Cookies): (self: HttpServerResponse) => HttpServerResponse;
(self: HttpServerResponse, cookies: Cookies): HttpServerResponse;
};removeCookie
Added in v1.0.0
Source
Signature
declare const removeCookie: {
(name: string): (self: HttpServerResponse) => HttpServerResponse;
(self: HttpServerResponse, name: string): HttpServerResponse;
};replaceCookies
Added in v1.0.0
Source
Signature
declare const replaceCookies: {
(cookies: Cookies): (self: HttpServerResponse) => HttpServerResponse;
(self: HttpServerResponse, cookies: Cookies): HttpServerResponse;
};Signature
declare const setBody: {
(body: HttpBody): (self: HttpServerResponse) => HttpServerResponse;
(self: HttpServerResponse, body: HttpBody): HttpServerResponse;
};Signature
declare const setCookie: {
(
name: string,
value: string,
options?: {
readonly domain?: string;
readonly expires?: Date;
readonly httpOnly?: boolean;
readonly maxAge?: Duration.DurationInput;
readonly partitioned?: boolean;
readonly path?: string;
readonly priority?: "low" | "medium" | "high";
readonly sameSite?: "lax" | "strict" | "none";
readonly secure?: boolean;
},
): (self: HttpServerResponse) => Effect<HttpServerResponse, CookiesError>;
(
self: HttpServerResponse,
name: string,
value: string,
options?: {
readonly domain?: string;
readonly expires?: Date;
readonly httpOnly?: boolean;
readonly maxAge?: Duration.DurationInput;
readonly partitioned?: boolean;
readonly path?: string;
readonly priority?: "low" | "medium" | "high";
readonly sameSite?: "lax" | "strict" | "none";
readonly secure?: boolean;
},
): Effect<HttpServerResponse, CookiesError>;
};setCookies
Added in v1.0.0
Source
Signature
declare const setCookies: {
(
cookies: Iterable<
readonly [
string,
string,
(
| {
readonly domain?: string;
readonly expires?: Date;
readonly httpOnly?: boolean;
readonly maxAge?: Duration.DurationInput;
readonly partitioned?: boolean;
readonly path?: string;
readonly priority?: "low" | "medium" | "high";
readonly sameSite?: "lax" | "strict" | "none";
readonly secure?: boolean;
}
| undefined
),
]
>,
): (self: HttpServerResponse) => Effect<HttpServerResponse, CookiesError, never>;
(
self: HttpServerResponse,
cookies: Iterable<
readonly [
string,
string,
(
| {
readonly domain?: string;
readonly expires?: Date;
readonly httpOnly?: boolean;
readonly maxAge?: Duration.DurationInput;
readonly partitioned?: boolean;
readonly path?: string;
readonly priority?: "low" | "medium" | "high";
readonly sameSite?: "lax" | "strict" | "none";
readonly secure?: boolean;
}
| undefined
),
]
>,
): Effect<HttpServerResponse, CookiesError, never>;
};Signature
declare const setHeader: {
(key: string, value: string): (self: HttpServerResponse) => HttpServerResponse;
(self: HttpServerResponse, key: string, value: string): HttpServerResponse;
};setHeaders
Added in v1.0.0
Source
Signature
declare const setHeaders: {
(input: Input): (self: HttpServerResponse) => HttpServerResponse;
(self: HttpServerResponse, input: Input): HttpServerResponse;
};Signature
declare const setStatus: {
(status: number, statusText?: string): (self: HttpServerResponse) => HttpServerResponse;
(self: HttpServerResponse, status: number, statusText?: string): HttpServerResponse;
};unsafeSetCookie
Added in v1.0.0
Source
Signature
declare const unsafeSetCookie: {
(
name: string,
value: string,
options?: {
readonly domain?: string;
readonly expires?: Date;
readonly httpOnly?: boolean;
readonly maxAge?: Duration.DurationInput;
readonly partitioned?: boolean;
readonly path?: string;
readonly priority?: "low" | "medium" | "high";
readonly sameSite?: "lax" | "strict" | "none";
readonly secure?: boolean;
},
): (self: HttpServerResponse) => HttpServerResponse;
(
self: HttpServerResponse,
name: string,
value: string,
options?: {
readonly domain?: string;
readonly expires?: Date;
readonly httpOnly?: boolean;
readonly maxAge?: Duration.DurationInput;
readonly partitioned?: boolean;
readonly path?: string;
readonly priority?: "low" | "medium" | "high";
readonly sameSite?: "lax" | "strict" | "none";
readonly secure?: boolean;
},
): HttpServerResponse;
};unsafeSetCookies
Added in v1.0.0
Source
Signature
declare const unsafeSetCookies: {
(
cookies: Iterable<
readonly [
string,
string,
(
| {
readonly domain?: string;
readonly expires?: Date;
readonly httpOnly?: boolean;
readonly maxAge?: Duration.DurationInput;
readonly partitioned?: boolean;
readonly path?: string;
readonly priority?: "low" | "medium" | "high";
readonly sameSite?: "lax" | "strict" | "none";
readonly secure?: boolean;
}
| undefined
),
]
>,
): (self: HttpServerResponse) => HttpServerResponse;
(
self: HttpServerResponse,
cookies: Iterable<
readonly [
string,
string,
(
| {
readonly domain?: string;
readonly expires?: Date;
readonly httpOnly?: boolean;
readonly maxAge?: Duration.DurationInput;
readonly partitioned?: boolean;
readonly path?: string;
readonly priority?: "low" | "medium" | "high";
readonly sameSite?: "lax" | "strict" | "none";
readonly secure?: boolean;
}
| undefined
),
]
>,
): HttpServerResponse;
};updateCookies
Added in v1.0.0
Source
Signature
declare const updateCookies: {
(f: (cookies: Cookies) => Cookies): (self: HttpServerResponse) => HttpServerResponse;
(self: HttpServerResponse, f: (cookies: Cookies) => Cookies): HttpServerResponse;
};Constructors
Signature
declare const empty: (options?: Options.WithContent) => HttpServerResponse;Signature
declare const file: (
path: string,
options?: Options & FileSystem.StreamOptions,
) => Effect.Effect<HttpServerResponse, PlatformError.PlatformError, Platform.HttpPlatform>;Signature
declare const fileWeb: (
file: Body.HttpBody.FileLike,
options?: Options.WithContent & FileSystem.StreamOptions,
) => Effect.Effect<HttpServerResponse, never, Platform.HttpPlatform>;Signature
declare const formData: (body: FormData, options?: Options.WithContent) => HttpServerResponse;Signature
declare const html: {
<A extends readonly Array<Interpolated>>(strings: TemplateStringsArray, ...args: A): Effect<HttpServerResponse, Error<A[number]>, Context<A[number]>>;
(html: string): HttpServerResponse;
}htmlStream
Added in v1.0.0
Source
Signature
declare const htmlStream: <A extends ReadonlyArray<Template.InterpolatedWithStream>>(
strings: TemplateStringsArray,
...args: A
) => Effect.Effect<HttpServerResponse, never, Template.Interpolated.Context<A[number]>>;Signature
declare const json: (
body: unknown,
options?: Options.WithContentType,
) => Effect.Effect<HttpServerResponse, Body.HttpBodyError>;Signature
declare const raw: (body: unknown, options?: Options) => HttpServerResponse;Signature
declare const redirect: (
location: string | URL,
options?: Options.WithContentType,
) => HttpServerResponse;schemaJson
Added in v1.0.0
Source
Signature
declare const schemaJson: <A, I, R>(
schema: Schema.Schema<A, I, R>,
options?: ParseOptions,
) => (
body: A,
options?: Options.WithContentType,
) => Effect.Effect<HttpServerResponse, Body.HttpBodyError, R>;Signature
declare const stream: <E>(
body: Stream.Stream<Uint8Array, E, never>,
options?: Options,
) => HttpServerResponse;Signature
declare const text: (body: string, options?: Options.WithContentType) => HttpServerResponse;uint8Array
Added in v1.0.0
Source
Signature
declare const uint8Array: (
body: Uint8Array,
options?: Options.WithContentType,
) => HttpServerResponse;unsafeJson
Added in v1.0.0
Source
Signature
declare const unsafeJson: (body: unknown, options?: Options.WithContentType) => HttpServerResponse;Signature
declare const urlParams: (
body: UrlParams.Input,
options?: Options.WithContentType,
) => HttpServerResponse;Conversions
Signature
declare function fromWeb(response: Response): HttpServerResponse;Signature
declare const toWeb: (
response: HttpServerResponse,
options?: {
readonly runtime?: Runtime.Runtime<never>;
readonly withoutBody?: boolean;
},
) => Response;Models
HttpServerResponse interface
Added in v1.0.0
Source
Signature
interface HttpServerResponse extends Effect<HttpServerResponse>, Inspectable, Respondable {
readonly [TypeId]: typeof TypeId;
readonly body: HttpBody;
readonly cookies: Cookies;
readonly headers: Headers;
readonly status: number;
readonly statusText?: string;
}Signature
interface Options {
readonly contentLength?: number;
readonly contentType?: string;
readonly cookies?: Cookies;
readonly headers?: Input;
readonly status?: number;
readonly statusText?: string;
}Other
isServerResponse
Added in v1.0.0
Source
Signature
declare const isServerResponse: (u: unknown) => u is HttpServerResponse;