Skip to main content Link Search Menu Expand Document (external link)

HttpServerResponse.ts overview

Since v1.0.0


Exports Grouped by Category


combinators

mergeCookies

Signature

declare const mergeCookies: {
  (cookies: Cookies): (self: HttpServerResponse) => HttpServerResponse
  (self: HttpServerResponse, cookies: Cookies): HttpServerResponse
}

Source

Since v1.0.0

removeCookie

Signature

declare const removeCookie: {
  (name: string): (self: HttpServerResponse) => HttpServerResponse
  (self: HttpServerResponse, name: string): HttpServerResponse
}

Source

Since v1.0.0

replaceCookies

Signature

declare const replaceCookies: {
  (cookies: Cookies): (self: HttpServerResponse) => HttpServerResponse
  (self: HttpServerResponse, cookies: Cookies): HttpServerResponse
}

Source

Since v1.0.0

setBody

Signature

declare const setBody: {
  (body: Body.HttpBody): (self: HttpServerResponse) => HttpServerResponse
  (self: HttpServerResponse, body: Body.HttpBody): HttpServerResponse
}

Source

Since v1.0.0

setCookie

Signature

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>
}

Source

Since v1.0.0

setCookies

Signature

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>
}

Source

Since v1.0.0

setHeader

Signature

declare const setHeader: {
  (key: string, value: string): (self: HttpServerResponse) => HttpServerResponse
  (self: HttpServerResponse, key: string, value: string): HttpServerResponse
}

Source

Since v1.0.0

setHeaders

Signature

declare const setHeaders: {
  (input: Headers.Input): (self: HttpServerResponse) => HttpServerResponse
  (self: HttpServerResponse, input: Headers.Input): HttpServerResponse
}

Source

Since v1.0.0

setStatus

Signature

declare const setStatus: {
  (status: number, statusText?: string | undefined): (self: HttpServerResponse) => HttpServerResponse
  (self: HttpServerResponse, status: number, statusText?: string | undefined): HttpServerResponse
}

Source

Since v1.0.0

unsafeSetCookie

Signature

declare const unsafeSetCookie: {
  (name: string, value: string, options?: Cookie["options"]): (self: HttpServerResponse) => HttpServerResponse
  (self: HttpServerResponse, name: string, value: string, options?: Cookie["options"]): HttpServerResponse
}

Source

Since v1.0.0

unsafeSetCookies

Signature

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
}

Source

Since v1.0.0

updateCookies

Signature

declare const updateCookies: {
  (f: (cookies: Cookies) => Cookies): (self: HttpServerResponse) => HttpServerResponse
  (self: HttpServerResponse, f: (cookies: Cookies) => Cookies): HttpServerResponse
}

Source

Since v1.0.0

constructors

empty

Signature

declare const empty: (options?: Options.WithContent | undefined) => HttpServerResponse

Source

Since v1.0.0

file

Signature

declare const file: (
  path: string,
  options?: (Options & FileSystem.StreamOptions) | undefined
) => Effect.Effect<HttpServerResponse, PlatformError.PlatformError, Platform.HttpPlatform>

Source

Since v1.0.0

fileWeb

Signature

declare const fileWeb: (
  file: Body.HttpBody.FileLike,
  options?: (Options.WithContent & FileSystem.StreamOptions) | undefined
) => Effect.Effect<HttpServerResponse, never, Platform.HttpPlatform>

Source

Since v1.0.0

formData

Signature

declare const formData: (body: FormData, options?: Options.WithContent | undefined) => HttpServerResponse

Source

Since v1.0.0

html

Signature

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
}

Source

Since v1.0.0

htmlStream

Signature

declare const htmlStream: <A extends ReadonlyArray<Template.InterpolatedWithStream>>(
  strings: TemplateStringsArray,
  ...args: A
) => Effect.Effect<HttpServerResponse, never, Template.Interpolated.Context<A[number]>>

Source

Since v1.0.0

json

Signature

declare const json: (
  body: unknown,
  options?: Options.WithContentType | undefined
) => Effect.Effect<HttpServerResponse, Body.HttpBodyError>

Source

Since v1.0.0

raw

Signature

declare const raw: (body: unknown, options?: Options | undefined) => HttpServerResponse

Source

Since v1.0.0

redirect

Signature

declare const redirect: (location: string | URL, options?: Options.WithContentType | undefined) => HttpServerResponse

Source

Since v1.0.0

schemaJson

Signature

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>

Source

Since v1.0.0

stream

Signature

declare const stream: <E>(
  body: Stream.Stream<Uint8Array, E, never>,
  options?: Options | undefined
) => HttpServerResponse

Source

Since v1.0.0

text

Signature

declare const text: (body: string, options?: Options.WithContentType | undefined) => HttpServerResponse

Source

Since v1.0.0

uint8Array

Signature

declare const uint8Array: (body: Uint8Array, options?: Options.WithContentType | undefined) => HttpServerResponse

Source

Since v1.0.0

unsafeJson

Signature

declare const unsafeJson: (body: unknown, options?: Options.WithContentType | undefined) => HttpServerResponse

Source

Since v1.0.0

urlParams

Signature

declare const urlParams: (body: UrlParams.Input, options?: Options.WithContentType | undefined) => HttpServerResponse

Source

Since v1.0.0

conversions

toWeb

Signature

declare const toWeb: (
  response: HttpServerResponse,
  options?: { readonly withoutBody?: boolean | undefined; readonly runtime?: Runtime.Runtime<never> | undefined }
) => Response

Source

Since 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
}

Source

Since 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
}

Source

Since v1.0.0

type ids

TypeId

Signature

declare const TypeId: unique symbol

Source

Since v1.0.0

TypeId (type alias)

Signature

type TypeId = typeof TypeId

Source

Since v1.0.0

utils

Options (namespace)

Source

Since v1.0.0

WithContent (interface)

Signature

export interface WithContent extends Omit<Options, "contentType" | "contentLength"> {}

Source

Since v1.0.0

WithContentType (interface)

Signature

export interface WithContentType extends Omit<Options, "contentLength"> {}

Source

Since v1.0.0

isServerResponse

Signature

declare const isServerResponse: (u: unknown) => u is HttpServerResponse

Source

Since v1.0.0