binary content post for android

This commit is contained in:
Vladimir Enchev
2014-05-27 09:08:48 +03:00
parent b4b2f7dfe7
commit a548837216
2 changed files with 8 additions and 6 deletions

View File

@ -405,11 +405,9 @@ declare module com {
constructor(source: string);
static extends(source: any);
}
export class UrlEncodedFormBody {
constructor(source: any);
}
export class StreamBody {
constructor(source: java.io.InputStream, length: number);
static extends(source: any);
}
}
}

View File

@ -28,11 +28,15 @@ export function request(options: http.HttpRequestOptions): promises.Promise<http
return null;
}
});
request.setBody(new stringBody(options.content));
}
else {
// TODO: How to transfer everything else?
else if (typeof options.content !== "undefined") {
var streamBody = com.koushikdutta.async.http.body.StreamBody.extends({
getContentType: function () {
return null;
}
});
request.setBody(new com.koushikdutta.async.http.body.StreamBody(new java.io.ByteArrayInputStream(options.content), options.content.length));
}
var callback = new com.koushikdutta.async.http.callback.HttpConnectCallback({