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

HttpClientRequest overview

Added in v1.0.0


Table of contents


combinators

accept

Signature

export declare const accept: {
  (mediaType: string): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, mediaType: string): HttpClientRequest
}

Added in v1.0.0

acceptJson

Signature

export declare const acceptJson: (self: HttpClientRequest) => HttpClientRequest

Added in v1.0.0

appendUrl

Signature

export declare const appendUrl: {
  (path: string): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, path: string): HttpClientRequest
}

Added in v1.0.0

appendUrlParam

Signature

export declare const appendUrlParam: {
  (key: string, value: string): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, key: string, value: string): HttpClientRequest
}

Added in v1.0.0

appendUrlParams

Signature

export declare const appendUrlParams: {
  (input: UrlParams.Input): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, input: UrlParams.Input): HttpClientRequest
}

Added in v1.0.0

basicAuth

Signature

export declare const basicAuth: {
  (username: string | Redacted, password: string | Redacted): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, username: string | Redacted, password: string | Redacted): HttpClientRequest
}

Added in v1.0.0

bearerToken

Signature

export declare const bearerToken: {
  (token: string | Redacted): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, token: string | Redacted): HttpClientRequest
}

Added in v1.0.0

bodyFile

Signature

export declare const bodyFile: {
  (
    path: string,
    options?: FileSystem.StreamOptions & { readonly contentType?: string }
  ): (self: HttpClientRequest) => Effect.Effect<HttpClientRequest, PlatformError.PlatformError, FileSystem.FileSystem>
  (
    self: HttpClientRequest,
    path: string,
    options?: FileSystem.StreamOptions & { readonly contentType?: string }
  ): Effect.Effect<HttpClientRequest, PlatformError.PlatformError, FileSystem.FileSystem>
}

Added in v1.0.0

bodyFileWeb

Signature

export declare const bodyFileWeb: {
  (file: Body.HttpBody.FileLike): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, file: Body.HttpBody.FileLike): HttpClientRequest
}

Added in v1.0.0

bodyFormData

Signature

export declare const bodyFormData: {
  (body: FormData): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, body: FormData): HttpClientRequest
}

Added in v1.0.0

bodyJson

Signature

export declare const bodyJson: {
  (body: unknown): (self: HttpClientRequest) => Effect.Effect<HttpClientRequest, Body.HttpBodyError>
  (self: HttpClientRequest, body: unknown): Effect.Effect<HttpClientRequest, Body.HttpBodyError>
}

Added in v1.0.0

bodyStream

Signature

export declare const bodyStream: {
  (
    body: Stream.Stream<Uint8Array, unknown>,
    options?: { readonly contentType?: string | undefined; readonly contentLength?: number | undefined } | undefined
  ): (self: HttpClientRequest) => HttpClientRequest
  (
    self: HttpClientRequest,
    body: Stream.Stream<Uint8Array, unknown>,
    options?: { readonly contentType?: string | undefined; readonly contentLength?: number | undefined } | undefined
  ): HttpClientRequest
}

Added in v1.0.0

bodyText

Signature

export declare const bodyText: {
  (body: string, contentType?: string): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, body: string, contentType?: string): HttpClientRequest
}

Added in v1.0.0

bodyUint8Array

Signature

export declare const bodyUint8Array: {
  (body: Uint8Array, contentType?: string): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, body: Uint8Array, contentType?: string): HttpClientRequest
}

Added in v1.0.0

bodyUnsafeJson

Signature

export declare const bodyUnsafeJson: {
  (body: unknown): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, body: unknown): HttpClientRequest
}

Added in v1.0.0

bodyUrlParams

Signature

export declare const bodyUrlParams: {
  (input: UrlParams.Input): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, input: UrlParams.Input): HttpClientRequest
}

Added in v1.0.0

modify

Signature

export declare const modify: {
  (options: Options): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, options: Options): HttpClientRequest
}

Added in v1.0.0

prependUrl

Signature

export declare const prependUrl: {
  (path: string): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, path: string): HttpClientRequest
}

Added in v1.0.0

removeHash

Signature

export declare const removeHash: (self: HttpClientRequest) => HttpClientRequest

Added in v1.0.0

schemaBodyJson

Signature

export declare const schemaBodyJson: <A, I, R>(
  schema: Schema.Schema<A, I, R>,
  options?: ParseOptions | undefined
) => {
  (body: A): (self: HttpClientRequest) => Effect.Effect<HttpClientRequest, Body.HttpBodyError, R>
  (self: HttpClientRequest, body: A): Effect.Effect<HttpClientRequest, Body.HttpBodyError, R>
}

Added in v1.0.0

setBody

Signature

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

Added in v1.0.0

setHash

Signature

export declare const setHash: {
  (hash: string): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, hash: string): HttpClientRequest
}

Added in v1.0.0

setHeader

Signature

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

Added in v1.0.0

setHeaders

Signature

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

Added in v1.0.0

setMethod

Signature

export declare const setMethod: {
  (method: HttpMethod): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, method: HttpMethod): HttpClientRequest
}

Added in v1.0.0

setUrl

Signature

export declare const setUrl: {
  (url: string | URL): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, url: string | URL): HttpClientRequest
}

Added in v1.0.0

setUrlParam

Signature

export declare const setUrlParam: {
  (key: string, value: string): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, key: string, value: string): HttpClientRequest
}

Added in v1.0.0

setUrlParams

Signature

export declare const setUrlParams: {
  (input: UrlParams.Input): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, input: UrlParams.Input): HttpClientRequest
}

Added in v1.0.0

updateUrl

Signature

export declare const updateUrl: {
  (f: (url: string) => string): (self: HttpClientRequest) => HttpClientRequest
  (self: HttpClientRequest, f: (url: string) => string): HttpClientRequest
}

Added in v1.0.0

constructors

del

Signature

export declare const del: (url: string | URL, options?: Options.NoUrl) => HttpClientRequest

Added in v1.0.0

get

Signature

export declare const get: (url: string | URL, options?: Options.NoBody) => HttpClientRequest

Added in v1.0.0

Signature

export declare const head: (url: string | URL, options?: Options.NoBody) => HttpClientRequest

Added in v1.0.0

make

Signature

export declare const make: <M extends HttpMethod>(
  method: M
) => (
  url: string | URL,
  options?: (M extends "GET" | "HEAD" ? Options.NoBody : Options.NoUrl) | undefined
) => HttpClientRequest

Added in v1.0.0

options

Signature

export declare const options: (url: string | URL, options?: Options.NoUrl) => HttpClientRequest

Added in v1.0.0

patch

Signature

export declare const patch: (url: string | URL, options?: Options.NoUrl) => HttpClientRequest

Added in v1.0.0

post

Signature

export declare const post: (url: string | URL, options?: Options.NoUrl) => HttpClientRequest

Added in v1.0.0

put

Signature

export declare const put: (url: string | URL, options?: Options.NoUrl) => HttpClientRequest

Added in v1.0.0

models

HttpClientRequest (interface)

Signature

export interface HttpClientRequest extends Inspectable, Pipeable {
  readonly [TypeId]: TypeId
  readonly method: HttpMethod
  readonly url: string
  readonly urlParams: UrlParams.UrlParams
  readonly hash: Option.Option<string>
  readonly headers: Headers.Headers
  readonly body: Body.HttpBody
}

Added in v1.0.0

Options (interface)

Signature

export interface Options {
  readonly method?: HttpMethod | undefined
  readonly url?: string | URL | undefined
  readonly urlParams?: UrlParams.Input | undefined
  readonly hash?: string | undefined
  readonly headers?: Headers.Input | undefined
  readonly body?: Body.HttpBody | undefined
  readonly accept?: string | undefined
  readonly acceptJson?: boolean | 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

NoBody (interface)

Signature

export interface NoBody extends Omit<Options, "method" | "url" | "body"> {}

Added in v1.0.0

NoUrl (interface)

Signature

export interface NoUrl extends Omit<Options, "method" | "url"> {}

Added in v1.0.0