http/client
Documentation
- source: http/client.ts
Overview
Classes
HttpClient
get()
Executes a synchronous HTTP GET request.
tsstatic get(url: string, options: HttpClientRequestOptions): HttpClientResponse;
Parameter Type Description 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.
tsstatic post(url: string, options: HttpClientRequestOptions): HttpClientResponse;
Parameter Type Description 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.
tsstatic put(url: string, options: HttpClientRequestOptions): HttpClientResponse;
Parameter Type Description urlstringThe target URL. optionsHttpClientRequestOptionsConfiguration options for the request. Returns
- Type:
HttpClientResponse- Description: The parsed response object.
patch()
Executes a synchronous HTTP PATCH request.
tsstatic patch(url: string, options: HttpClientRequestOptions): HttpClientResponse;
Parameter Type Description urlstringThe target URL. optionsHttpClientRequestOptionsConfiguration options for the request. Returns
- Type:
HttpClientResponse- Description: The parsed response object.
delete()
Executes a synchronous HTTP DELETE request.
tsstatic delete(url: string, options: HttpClientRequestOptions): HttpClientResponse;
Parameter Type Description 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.
tsstatic del(url: string, options: HttpClientRequestOptions): HttpClientResponse;
Parameter Type Description urlstringThe target URL. optionsHttpClientRequestOptionsConfiguration options for the request. Returns
- Type:
HttpClientResponse- Description: The parsed response object.
head()
Executes a synchronous HTTP HEAD request (fetches headers only).
tsstatic head(url: string, options: HttpClientRequestOptions): HttpClientResponse;
Parameter Type Description 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.
tsstatic trace(url: string, options: HttpClientRequestOptions): HttpClientResponse;
Parameter Type Description urlstringThe target URL. optionsHttpClientRequestOptionsConfiguration options for the request. Returns
- Type:
HttpClientResponse- Description: The parsed response object.
