XMLHttpRequest separated from http

This commit is contained in:
Vladimir Enchev
2015-07-20 10:58:29 +03:00
parent d3c987f827
commit 54c0de8df6
2 changed files with 46 additions and 45 deletions

View File

@@ -1734,7 +1734,9 @@
<ItemGroup>
<Content Include="js-libs\esprima\README.md" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="apps\list-view-demo\" />
</ItemGroup>
<!-- To save maintenance effort, the Visual Studio build does not rely on the Microsoft targets.
Instead, it calls the Grunt build.
-->
@@ -1785,7 +1787,7 @@
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
<UserProperties ui_2layouts_2wrap-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2grid-layout_2package_1json__JSONSchema="" ui_2layouts_2dock-layout_2package_1json__JSONSchema="" ui_2layouts_2absolute-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2linear-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2web-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2content-view_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2gallery-app_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2absolute-layout-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2editable-text-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2scroll-view_2package_1json__JSONSchema="http://json.schemastore.org/package" />
<UserProperties ui_2scroll-view_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2editable-text-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2absolute-layout-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2gallery-app_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2content-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2web-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2linear-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2absolute-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2dock-layout_2package_1json__JSONSchema="" ui_2layouts_2grid-layout_2package_1json__JSONSchema="" ui_2layouts_2wrap-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" />
</VisualStudio>
</ProjectExtensions>
</Project>

View File

@@ -333,15 +333,15 @@ export var test_request_headersSentAndReceivedProperly = function (done) {
method: "GET",
headers: { "Content-Type": "application/json" }
}).then(function (response) {
result = response.headers;
try {
TKUnit.assert(result["Content-Type"] === "application/json", "Headers not sent/received properly!");
done(null);
}
catch (err) {
done(err);
}
}, function (e) {
result = response.headers;
try {
TKUnit.assert(result["Content-Type"] === "application/json", "Headers not sent/received properly!");
done(null);
}
catch (err) {
done(err);
}
}, function (e) {
done(e);
});
};
@@ -355,15 +355,15 @@ export var test_request_contentSentAndReceivedProperly = function (done) {
headers: { "Content-Type": "application/x-www-form-urlencoded" },
content: "MyVariableOne=ValueOne&MyVariableTwo=ValueTwo"
}).then(function (response) {
result = response.content.toJSON();
try {
TKUnit.assert(result["form"]["MyVariableOne"] === "ValueOne" && result["form"]["MyVariableTwo"] === "ValueTwo", "Content not sent/received properly!");
done(null);
}
catch (err) {
done(err);
}
}, function (e) {
result = response.content.toJSON();
try {
TKUnit.assert(result["form"]["MyVariableOne"] === "ValueOne" && result["form"]["MyVariableTwo"] === "ValueTwo", "Content not sent/received properly!");
done(null);
}
catch (err) {
done(err);
}
}, function (e) {
done(e);
});
};
@@ -379,15 +379,15 @@ export var test_request_NonStringHeadersSentAndReceivedProperly = function (done
headers: { "Content-Type": "application/x-www-form-urlencoded", "Content-Length": postData.length },
content: postData
}).then(function (response) {
result = response.content.toJSON();
try {
TKUnit.assert(result["form"]["MyVariableOne"] === "ValueOne" && result["form"]["MyVariableTwo"] === "ValueTwo", "Content not sent/received properly!");
done(null);
}
catch (err) {
done(err);
}
}, function (e) {
result = response.content.toJSON();
try {
TKUnit.assert(result["form"]["MyVariableOne"] === "ValueOne" && result["form"]["MyVariableTwo"] === "ValueTwo", "Content not sent/received properly!");
done(null);
}
catch (err) {
done(err);
}
}, function (e) {
done(e);
});
};
@@ -404,24 +404,23 @@ export var test_request_jsonAsContentSentAndReceivedProperly = function (done) {
headers: { "Content-Type": "application/json" },
content: JSON.stringify({ MyVariableOne: "ValueOne", MyVariableTwo: "ValueTwo" })
}).then(function (response) {
// result = response.content.toJSON();
// <hide>
result = response.content.toJSON();
try
{
TKUnit.assert(result["json"]["MyVariableOne"] === "ValueOne" && result["json"]["MyVariableTwo"] === "ValueTwo", "Content not sent/received properly!");
done(null);
}
catch (err) {
done(err);
}
// result = response.content.toJSON();
// <hide>
result = response.content.toJSON();
try {
TKUnit.assert(result["json"]["MyVariableOne"] === "ValueOne" && result["json"]["MyVariableTwo"] === "ValueTwo", "Content not sent/received properly!");
done(null);
}
catch (err) {
done(err);
}
// </hide>
// console.log(result);
}, function (e) {
// <hide>
}, function (e) {
// <hide>
done(e);
// </hide>
// console.log("Error occurred " + e);
// </hide>
// console.log("Error occurred " + e);
});
// ```
// </snippet>
@@ -452,4 +451,4 @@ function doRequest(url: string, done: Function) {
}, function (e) {
done(e);
});
}
};