populate status for readystate 2 in more cases #98
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've added a test, but unfortunately the test was passing before this change so it doesn't exhibit the true problem.
The issue I've run into is using xhook via xdomain with the
aws-sdk
.Specifically, if I have the following code in the browser:
Without this change, that code results in an error because the
readyState == 3
change has not yet set 'status'.With this change, the above code seems to work correctly.
I think that the main difference between the test environment and the AWS request is that the AWS request is chunked, so the headers really are sent before the body... I couldn't figure out a way to reproduce the error in the mocha test environment.
If you're interested, the aws-sdk code making the request which fails without this change is here.