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

populate status for readystate 2 in more cases #98

Open
wants to merge 3 commits into
base: gh-pages
from

Conversation

@euank
Copy link

commented Nov 7, 2018

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:

<script src="my-copy-of-xdomain-built-with-new-xhook/xdomain.js" debug="true" slave="https://s3.amazonaws.com/my-bucket/proxy.html"></script>
var creds = new AWS.Credentials({
  accessKeyId: 'akid',
  secretAccessKey: 'asecret',
});
AWS.config.update({region: 'us-east-1', credentials: creds, logger: console, s3ForcePathStyle: true});
var s3 = new AWS.S3();

s3.listBuckets().promise()
.then(data => console.log(data))
.catch(err => console.log(err));

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.

euank added some commits Nov 7, 2018

rename gruntsource file to correct name
On case-sensitive filesystems with modern versions of grunt-source, it
requires a lowercause 's' there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.