Skip to content
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

Define XMLHttpRequest failure #32447

Merged
merged 4 commits into from
Feb 29, 2024
Merged

Define XMLHttpRequest failure #32447

merged 4 commits into from
Feb 29, 2024

Conversation

JayAgra
Copy link
Contributor

@JayAgra JayAgra commented Feb 26, 2024

Description

Attempting to resolve #31129 by specifying a failed request is a non-2XX response code.

Motivation

Just looking to clarify the confusion found by @maxpblum

Additional details

MDN response code docs https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

Related issues and pull requests

Fixes #31129

@JayAgra JayAgra requested a review from a team as a code owner February 26, 2024 17:19
@JayAgra JayAgra requested review from wbamberg and removed request for a team February 26, 2024 17:19
@github-actions github-actions bot added Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed labels Feb 26, 2024
Copy link
Contributor

github-actions bot commented Feb 26, 2024

Preview URLs

(comment last updated: 2024-02-29 19:38:25)

Copy link
Collaborator

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to me like null is never the value. I don't see a path here where null is returned.

And this code:

const xhr = new XMLHttpRequest();
xhr.open("GET", "https://httpbin.org/status/503");

// If specified, responseType must be empty string or "text"
xhr.responseType = "text";

xhr.onloadend = () => {
      console.log(xhr.status);
      console.log(xhr.responseText);
};

xhr.send();

...gives me:

503
<empty string>

@JayAgra
Copy link
Contributor Author

JayAgra commented Feb 27, 2024

You're absolutely correct, I'll remove the whole statement "or null if the request failed (non 2XX status)"

Co-authored-by: wbamberg <will@bootbonnet.ca>
@JayAgra JayAgra requested a review from wbamberg February 28, 2024 01:36
Copy link
Collaborator

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thank you @JayAgra !

@wbamberg wbamberg merged commit 062fca7 into mdn:main Feb 29, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Define XMLHttpRequest "failure" on the responseText MDN page?
2 participants