Skip to content

Commit 61de283

Browse files
author
Vladimir Enchev
committed
initial http tests & setup added
1 parent cfca745 commit 61de283

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

http/http_request.android.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function request(options: http.HttpRequestOptions): promises.Promise<http
1313

1414
var context = require("Application/application").Application.current.android.context;
1515

16-
if (isImage) {
16+
if (isImage && options.method && options.method.toLowerCase() == "get") {
1717
var request = com.koushikdutta.ion.Ion.with(context, options.url);
1818
request.asBitmap().setCallback(new com.koushikdutta.async.future.FutureCallback({
1919
onCompleted: function (error, data) {
@@ -41,7 +41,7 @@ export function request(options: http.HttpRequestOptions): promises.Promise<http
4141
if (options.headers) {
4242
for (var key in options.headers) {
4343
request.addHeader(key, options.headers[key])
44-
}
44+
}
4545
}
4646

4747
if (typeof options.timeout == "number") {
@@ -74,11 +74,7 @@ export function request(options: http.HttpRequestOptions): promises.Promise<http
7474
toString: () => { return result },
7575
toJSON: () => { return JSON.parse(result) },
7676
toImage: () => {
77-
var imageAsBytes = new java.lang.String(result).getBytes();
78-
var bmp = android.graphics.BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length);
79-
// TODO: Implement this!
80-
//return null;
81-
return require("Image/image").Image.imageFromNativeBitmap(bmp);
77+
return null;
8278
}
8379
},
8480
statusCode: rawHeaders.getResponseCode(),

0 commit comments

Comments
 (0)