-
Notifications
You must be signed in to change notification settings - Fork 0
HttpClient class
Ron Buckton edited this page Jan 15, 2015
·
2 revisions
Performs asynchronous HTTP operations.
export class HttpClient {
constructor(baseUrl?: string | Uri);
public baseUrl: Uri;
public withCredentials: Boolean;
public timeout: number;
public username: string;
public password: string;
public close(): void;
public setRequestHeader(key: string, value: string): void;
public getStringAsync(url: string | Uri): Promise<string>;
public getAsync(url: string | Uri, token?: CancellationToken): Promise<HttpResponse>;
public getJsonpAsync<T>(url: string | Uri, callbackArg?: string, noCache?: boolean, token?: CancellationToken): Promise<T>;
public postAsync(url: string | Uri, body: any, token?: CancellationToken): Promise<HttpResponse>;
public postAsJsonAsync(url: string | Uri, value: any, jsonReplacer?: any[] | ((key: string, value: any) => string), token?: CancellationToken): Promise<HttpResponse>;
public putAsync(url: string | Uri, body: any, token?: CancellationToken): Promise<HttpResponse>;
public putAsJsonAsync(url: string | Uri, value: any, jsonReplacer?: any[] | ((key: string, value: any) => string), token?: CancellationToken): Promise<HttpResponse>;
public deleteAsync(url: string | Uri, token?: CancellationToken): Promise<HttpResponse>;
public sendAsync(request: HttpRequest, token?: CancellationToken): Promise<HttpResponse>;
}
- new HttpClient(String|Uri?)
- Creates a new HttpClient
- Gets or sets the base url for the client
- withCredentials
- Gets or sets a value indicating whether cookies should be sent to a cross-origin request
- timeout
- Gets or sets the number of milliseconds to wait before the request should timeout
- username
- Gets or sets the username for the request
- password
- Gets or sets the password for the request
- close()
- Closes the client and cancels all pending requests
- setRequestHeader(String,String)
- Sets a value for a default named request header
- getStringAsync(String|Uri)
- Gets the response text from the requested url
- getAsync(String|Uri,CancellationToken?)
- Gets the response from issuing an HTTP GET to the requested url
- postAsync(String|Uri,any,CancellationToken?)
- Gets the response from issuing an HTTP POST to the requested url
- postJsonAsync(String|Uri,any,any|Function?,CancellationToken?)
- Gets the response from issuing an HTTP POST of a JSON serialized value to the requested url
- putAsync(String|Uri,any,CancellationToken?)
- Gets the response from issuing an HTTP PUT to the requested url
- putJsonAsync(String|Uri,any,any|Function?,CancellationToken?)
- Gets the response from issuing an HTTP PUT of a JSON serialized value to the requested url
- deleteAsync(String|Uri,CancellationToken?)
- Gets the response from issuing an HTTP DELETE to the requested url
- sendAsync(HttpRequest,CancellationToken?)
- Sends the provided request and returns the response
- getJsonpAsync(String|Uri,String?,Boolean?,CancellationToken?)
- Issues a JSONP request.
- Supported Platforms: Browser
- Module: httpclient
- Library: httpclient.ts