mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
comments added
This commit is contained in:
46
http/http.d.ts
vendored
46
http/http.d.ts
vendored
@@ -45,24 +45,68 @@
|
||||
function request(options: HttpRequestOptions): promises.Promise<HttpResponse>;
|
||||
|
||||
interface HttpRequestOptions {
|
||||
/**
|
||||
* Gets or sets the request url.
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the request method.
|
||||
*/
|
||||
method: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the request headers in JSON format.
|
||||
*/
|
||||
headers?: any;
|
||||
|
||||
/**
|
||||
* Gets or sets the request body.
|
||||
*/
|
||||
content?: any;
|
||||
|
||||
/**
|
||||
* Gets or sets the request timeout.
|
||||
*/
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
interface HttpResponse {
|
||||
/**
|
||||
* Gets the response status code.
|
||||
*/
|
||||
statusCode: number;
|
||||
|
||||
/**
|
||||
* Gets the response headers.
|
||||
*/
|
||||
headers: any;
|
||||
|
||||
/**
|
||||
* Gets the response content.
|
||||
*/
|
||||
content?: HttpContent;
|
||||
}
|
||||
|
||||
interface HttpContent {
|
||||
/**
|
||||
* Gets the response body as raw data.
|
||||
*/
|
||||
raw: any;
|
||||
|
||||
/**
|
||||
* Gets the response body as string.
|
||||
*/
|
||||
toString: () => string;
|
||||
// TODO: Isn't parseJSON better naming? toJSON sounds to me like we will return a string object
|
||||
|
||||
/**
|
||||
* Gets the response body as JSON object.
|
||||
*/
|
||||
toJSON: () => any;
|
||||
|
||||
/**
|
||||
* Gets the response body as ImageSource.
|
||||
*/
|
||||
toImage: () => image.ImageSource;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user