The HTTP spec says it's 'Content-Type'

Fixes #67
master
slackersoft 10 years ago
parent 1f74c2fc96
commit 477f044b4a

@ -193,7 +193,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
this.responseText = response.responseText || "";
this.readyState = 4;
this.responseHeaders = response.responseHeaders ||
{"Content-type": response.contentType || "application/json" };
{"Content-Type": response.contentType || "application/json" };
this.onload();
this.onreadystatechange();

@ -18,7 +18,7 @@ describe("Jasmine Mock Ajax (for toplevel)", function() {
onreadystatechange = function() {
if (this.readyState == (this.DONE || 4)) { // IE 8 doesn't support DONE
if (this.status == 200) {
if (this.responseHeaders['Content-type'] === 'application/json') {
if (this.responseHeaders['Content-Type'] === 'application/json') {
this.response = JSON.parse(this.responseText);
} else {
this.response = this.responseText;
@ -407,7 +407,7 @@ function sharedAjaxResponseBehaviorForZepto_Success(context) {
});
it("should have the expected content type", function() {
expect(xhr.getResponseHeader('Content-type')).toEqual(context.contentType);
expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType);
});
it("should have the expected response text", function() {
@ -432,7 +432,7 @@ function sharedAjaxResponseBehaviorForZepto_Failure(context) {
});
it("should have the expected content type", function() {
expect(xhr.getResponseHeader('Content-type')).toEqual(context.contentType);
expect(xhr.getResponseHeader('Content-Type')).toEqual(context.contentType);
});
it("should have the expected response text", function() {

@ -37,7 +37,7 @@ describe("Webmock style mocking", function() {
it("should set the contentType", function() {
sendRequest(fakeGlobal);
expect(response.responseHeaders['Content-type']).toEqual('application/json');
expect(response.responseHeaders['Content-Type']).toEqual('application/json');
});
it("should set the responseText", function() {

Loading…
Cancel
Save