mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
http module fixed
This commit is contained in:
@ -36,7 +36,7 @@ export var test_getImage_isDefined = function () {
|
|||||||
|
|
||||||
export var test_getImage = function () {
|
export var test_getImage = function () {
|
||||||
http.getImage("http://www.google.com/images/errors/logo_sm_2.png").then(function (result) {
|
http.getImage("http://www.google.com/images/errors/logo_sm_2.png").then(function (result) {
|
||||||
TKUnit.assert(result instanceof require("Image").Image, "Result from getImage() should be valid Image object!");
|
TKUnit.assert(result instanceof require("image").Image, "Result from getImage() should be valid Image object!");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ export function request(options: http.HttpRequestOptions): promises.Promise<http
|
|||||||
raw: data,
|
raw: data,
|
||||||
toString: () => { return null },
|
toString: () => { return null },
|
||||||
toJSON: () => { return null },
|
toJSON: () => { return null },
|
||||||
toImage: () => { return require("Image/image").fromNativeBitmap(data); }
|
toImage: () => { return require("image").fromNativeBitmap(data); }
|
||||||
},
|
},
|
||||||
statusCode: 0,
|
statusCode: 0,
|
||||||
headers: {}
|
headers: {}
|
||||||
|
@ -56,7 +56,7 @@ export function request(options: http.HttpRequestOptions): promises.Promise<http
|
|||||||
raw: data,
|
raw: data,
|
||||||
toString: () => { return NSDataToString(data); },
|
toString: () => { return NSDataToString(data); },
|
||||||
toJSON: () => { return JSON.parse(NSDataToString(data)); },
|
toJSON: () => { return JSON.parse(NSDataToString(data)); },
|
||||||
toImage: () => { return require("Image/image").fromData(data); }
|
toImage: () => { return require("image").fromData(data); }
|
||||||
},
|
},
|
||||||
statusCode: response.statusCode(),
|
statusCode: response.statusCode(),
|
||||||
headers: headers
|
headers: headers
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
The way we get local path here is different for now. Maybe we should get it from FS module in the future samples. Sample code Android:
|
The way we get local path here is different for now. Maybe we should get it from FS module in the future samples. Sample code Android:
|
||||||
|
|
||||||
```
|
```
|
||||||
var Image = require("Image").Image;
|
var Image = require("image").Image;
|
||||||
var baseImage = Image.imageFromResource('foxie');
|
var baseImage = Image.imageFromResource('foxie');
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user