mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
request body for android fixed and test added
This commit is contained in:
@@ -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!");
|
||||
};
|
||||
Reference in New Issue
Block a user