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 }}
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: string }
Examples
all
Create multiple parallel HTTP requests and returns when all responses have been received. Responses are returned in an array in the same order as the requests.
Parameters
requests { 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 }}[]
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: 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 }}
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: 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 }}
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: 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 }}
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: 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 }}
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: 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 }}
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: 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 }}
Return type
{ data: any, status: number, statusText: string, headers: Record<string, string>, error?: string }
Examples
Last updated