New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft Edge returns error code 0 for request and doesn't offer a responseJSON #3828

Closed
AndreR opened this Issue Oct 27, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@AndreR

AndreR commented Oct 27, 2017

When calling my web service in the following manner, Chrome, FF and IE correctly reply with an error object which includes a proper responseJSON attribute. Microsoft Edge, however, reports a status "0" with the statusText "error". The object doesn't contain any additional information.

The web server always responds with an error 400 to this request:

$.post(Händlerportal.apiAddress + 'getToken', { username: 'abc', password: '123', grant_type: 'password' }).fail(e => console.log(e))

The raw response to this request is according to Google Chrome:

{"error":"invalid_grant","error_description":"Benutzername und Kennwort stimmen nicht überein."}

The expected result for parameter e should be:

"{"readyState":4,"responseText":"{\"error\":\"invalid_grant\",\"error_description\":\"Benutzername und Kennwort stimmen nicht überein.\"}","responseJSON":{"error":"invalid_grant","error_description":"Benutzername und Kennwort stimmen nicht überein."},"status":400,"statusText":"Bad Request"}"

Microsoft Edge, exclusively under all tested browsers, generates:

{"readyState":0,"status":0,"statusText":"error"}

@dmethvin

This comment has been minimized.

Show comment
Hide comment
@dmethvin

dmethvin Oct 27, 2017

Member

If you use a bare XHR does the problem persist? At the moment it seems like you're reporting an Edge bug and not a jQuery one, but there isn't enough information here (such as a standalone test case) to determine the actual issue.

Member

dmethvin commented Oct 27, 2017

If you use a bare XHR does the problem persist? At the moment it seems like you're reporting an Edge bug and not a jQuery one, but there isn't enough information here (such as a standalone test case) to determine the actual issue.

@AndreR

This comment has been minimized.

Show comment
Hide comment
@AndreR

AndreR Oct 27, 2017

Looks like it could really be a Edge bug. I created this little test code:

let xhr = new XMLHttpRequest(); xhr.open("POST", apiAddress + 'getToken', true); xhr.onreadystatechange = function () { console.log(xhr.readyState); console.log(xhr.status); }; xhr.send('username=abc&password=123&grant_type=password');

In other browsers, this will post the status 400, which is correct. In Edge, however, I get back status 0.

AndreR commented Oct 27, 2017

Looks like it could really be a Edge bug. I created this little test code:

let xhr = new XMLHttpRequest(); xhr.open("POST", apiAddress + 'getToken', true); xhr.onreadystatechange = function () { console.log(xhr.readyState); console.log(xhr.status); }; xhr.send('username=abc&password=123&grant_type=password');

In other browsers, this will post the status 400, which is correct. In Edge, however, I get back status 0.

@AndreR

This comment has been minimized.

Show comment
Hide comment
@AndreR

AndreR commented Oct 27, 2017

I've just created a ticket on Microsoft's bug tracker: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/14407632/

@timmywil

This comment has been minimized.

Show comment
Hide comment
@timmywil

timmywil Nov 1, 2017

Member

As far as I can tell, we can't really work around this or obfuscate the problem. We'll let Edge fix this.

Member

timmywil commented Nov 1, 2017

As far as I can tell, we can't really work around this or obfuscate the problem. We'll let Edge fix this.

@timmywil timmywil closed this Nov 1, 2017

@lock lock bot locked as resolved and limited conversation to collaborators Jun 17, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.