This interface is implemented by an HTTP client object. A reference to this object is obtained using the global http property.
interface IHttpClient {
// Methods
${request}(url: string, verb: string, options?: Partial<${IHttpRequestOptions}>): Promise<${IHttpResponse}>;
${get}(url: string, options?: Partial<${IHttpRequestOptions}>): Promise<${IHttpResponse}>;
${post}(url: string, options?: Partial<${IHttpRequestOptions}>): Promise<${IHttpResponse}>;
${getString}(url: string, accepts?: string, options?: Partial<${IHttpRequestOptions}>): Promise<string>;
${getBlob}(url: string, options?: Partial<${IHttpRequestOptions}>): Promise<Uint8Array>;
}
// This interface is not available in managed environment
// This interface is not available in native environment
request(url: string, verb: string, options?: Partial<${IHttpRequestOptions}>): Promise<${IHttpResponse}>;
// This method is not available in managed environment
// This method is not available in native environment
url
verb
options
An HTTP response object.
Make an HTTP request. All other methods of this interface eventually call this method. Prefer using other methods unless you want to customize an HTTP request properties.
get(url: string, options?: Partial<${IHttpRequestOptions}>): Promise<${IHttpResponse}>;
// This method is not available in managed environment
// This method is not available in native environment
url
options
An HTTP response object.
Send an HTTP GET request and obtain a response. Calls the request method.
post(url: string, options?: Partial<${IHttpRequestOptions}>): Promise<${IHttpResponse}>;
// This method is not available in managed environment
// This method is not available in native environment
url
options
An HTTP response object.
Send an HTTP POST request and obtain a response. Calls the request method.
getString(url: string, accepts?: string, options?: Partial<${IHttpRequestOptions}>): Promise<string>;
// This method is not available in managed environment
// This method is not available in native environment
url
accepts
Accepts
header. Defaults to application/json
.options
Contents of a remote resource as a string.
Send an HTTP GET request and returns the result as a string. Calls the request method.
getBlob(url: string, options?: Partial<${IHttpRequestOptions}>): Promise<Uint8Array>;
// This method is not available in managed environment
// This method is not available in native environment
url
options
Contents of a remote resource as a byte array.
Send an HTTP GET request and returns the result as a string. Calls the request method.