mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Sample code:
var http = require("http");
// Universal request method. You can use HttpRequestOptions to set varios properties like url, headers, etc.,
// HttpResponse to get status code, headers and content and HttpContent to get body of response:
interface HttpRequestOptions {
url: string;
method: string;
headers?: any;
content?: HttpContent;
}
interface HttpResponse {
statusCode: number;
headers: any;
content?: HttpContent;
}
interface HttpContent {
toString: () => string;
toJSON: () => any;
toImage: () => image_module.Image;
}
More info: https://github.com/telerik/xPlatCore/blob/master/Documentation/Snippets/http.md