Skip to content

http/client

Documentation

Overview

Classes

HttpClient

get()

Executes a synchronous HTTP GET request.

ts
static get(url: string, options: HttpClientRequestOptions): HttpClientResponse;
ParameterTypeDescription
urlstringThe target URL.
optionsHttpClientRequestOptionsConfiguration options for the request.

Returns

  • Type: HttpClientResponse
  • Description: The parsed response object containing status, headers, and body.

post()

Executes a synchronous HTTP POST request.

ts
static post(url: string, options: HttpClientRequestOptions): HttpClientResponse;
ParameterTypeDescription
urlstringThe target URL.
optionsHttpClientRequestOptionsConfiguration options for the request, including request body in `text` or `data`.

Returns

  • Type: HttpClientResponse
  • Description: The parsed response object.

put()

Executes a synchronous HTTP PUT request.

ts
static put(url: string, options: HttpClientRequestOptions): HttpClientResponse;
ParameterTypeDescription
urlstringThe target URL.
optionsHttpClientRequestOptionsConfiguration options for the request.

Returns

  • Type: HttpClientResponse
  • Description: The parsed response object.

patch()

Executes a synchronous HTTP PATCH request.

ts
static patch(url: string, options: HttpClientRequestOptions): HttpClientResponse;
ParameterTypeDescription
urlstringThe target URL.
optionsHttpClientRequestOptionsConfiguration options for the request.

Returns

  • Type: HttpClientResponse
  • Description: The parsed response object.

delete()

Executes a synchronous HTTP DELETE request.

ts
static delete(url: string, options: HttpClientRequestOptions): HttpClientResponse;
ParameterTypeDescription
urlstringThe target URL.
optionsHttpClientRequestOptionsConfiguration options for the request.

Returns

  • Type: HttpClientResponse
  • Description: The parsed response object.

del()

Alias for HttpClient.delete. Executes a synchronous HTTP DELETE request.

ts
static del(url: string, options: HttpClientRequestOptions): HttpClientResponse;
ParameterTypeDescription
urlstringThe target URL.
optionsHttpClientRequestOptionsConfiguration options for the request.

Returns

  • Type: HttpClientResponse
  • Description: The parsed response object.

Executes a synchronous HTTP HEAD request (fetches headers only).

ts
static head(url: string, options: HttpClientRequestOptions): HttpClientResponse;
ParameterTypeDescription
urlstringThe target URL.
optionsHttpClientRequestOptionsConfiguration options for the request.

Returns

  • Type: HttpClientResponse
  • Description: The parsed response object. The body (`text` and `data`) will typically be empty.

trace()

Executes a synchronous HTTP TRACE request.

ts
static trace(url: string, options: HttpClientRequestOptions): HttpClientResponse;
ParameterTypeDescription
urlstringThe target URL.
optionsHttpClientRequestOptionsConfiguration options for the request.

Returns

  • Type: HttpClientResponse
  • Description: The parsed response object.