request body for android fixed and test added

This commit is contained in:
Vladimir Enchev
2014-05-26 15:00:23 +03:00
parent b3a0b8df33
commit 82fa2b3b6e
3 changed files with 45 additions and 8 deletions

View File

@@ -304,4 +304,24 @@ export var test_request_headersSentAndReceivedProperly = function () {
TKUnit.waitUntilReady(isReady, 3);
TKUnit.assert(result["Content-Type"] === "application/json", "Headers not sent/received properly!");
};
export var test_request_contentSentAndReceivedProperly = function () {
var result;
var completed: boolean;
var isReady = function () { return completed; }
http.request({
url: "http://httpbin.org/post", method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
content: "MyVariableOne=ValueOne&MyVariableTwo=ValueTwo"
}).then(function (response) {
completed = true;
result = response.content.toJSON();
}).fail(function (e) {
console.log(e);
});
TKUnit.waitUntilReady(isReady, 3);
TKUnit.assert(result["form"]["MyVariableOne"] === "ValueOne" && result["form"]["MyVariableTwo"] === "ValueTwo", "Content not sent/received properly!");
};