Http
Collection of HTTP functions.
Methods
request
Create a HTTP Request. Can be used to post or get data to and from a URL.
Parameters
url string
The URL.
options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }, [x: any]: unknown }
(optional) Options object - set headers, method and other properties. More information
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string> }
Examples
get
Create a HTTP GET Request.
Parameters
url string
The URL.
options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }, [x: any]: unknown }
(optional) Options object - set headers, method and other properties. More information
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string> }
Examples
post
Create a HTTP POST Request.
Parameters
url string
The URL.
options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }, [x: any]: unknown }
(optional) Options object - set headers, method and other properties. More information
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string> }
Examples
put
Create a HTTP PUT Request.
Parameters
url string
The URL.
options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }, [x: any]: unknown }
(optional) Options object - set headers, method and other properties. More information
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string> }
Examples
delete
Create a HTTP DELETE Request.
Parameters
url string
The URL.
options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }, [x: any]: unknown }
(optional) Options object - set headers, method and other properties. More information
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string> }
Examples
head
Create a HTTP HEAD Request.
Parameters
url string
The URL.
options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }, [x: any]: unknown }
(optional) Options object - set headers, method and other properties. More information
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string> }
Examples
patch
Create a HTTP PATCH Request.
Parameters
url string
The URL.
options { method?: any, headers?: Record<string, string>, data?: any, wait?: boolean, url?: string, baseURL?: string, params?: any, timeout?: number, withCredentials?: boolean, auth?: any, responseType?: string, responseEncoding?: string, xsrfCookieName?: string, xsrfHeaderName?: string, maxContentLength?: number, maxBodyLength?: number, maxRedirects?: number, proxy?: any, decompress?: boolean, httpsAgent?: { ca?: string, key?: string, cert?: string, pfx?: string, ciphers?: string, passphrase?: string }, [x: any]: unknown }
(optional) Options object - set headers, method and other properties. More information
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string> }