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

Accept arrays as the request data #141

Merged
merged 1 commit into from
Jan 5, 2018
Merged

Accept arrays as the request data #141

merged 1 commit into from
Jan 5, 2018

Conversation

chasenlehara
Copy link
Member

This makes it so you can send an array as the data for a request and can-fixture won’t turn it into an object.

Closes #133

This makes it so you can send an array as the data for a request and can-fixture won’t turn it into an object.

Closes #133
});
xhr.open('POST', '/upload', true);
xhr.send(data);
});
Copy link
Member Author

Choose a reason for hiding this comment

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

I don’t think this test should’ve been wrapped in the "onabort" in XMLHttpRequest._XHR.prototype check.

// valid form types in addition to plain objects as URL search params
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/send
var formTypes = ['ArrayBuffer', 'ArrayBufferView', 'Blob', 'FormData'];

Copy link
Member Author

Choose a reason for hiding this comment

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

This change basically switches from explicitly checking for different types (ArrayBuffer, FormData, etc.) to checking for plain objects vs. everything else.

@matthewp
Copy link
Contributor

matthewp commented Jan 5, 2018

lgtm

@chasenlehara chasenlehara merged commit b9d634d into master Jan 5, 2018
@chasenlehara chasenlehara deleted the 133-array-data branch January 5, 2018 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FormData and other xhr send types are converted to plain objects
2 participants