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

[BUG #212] Send data should be serialized to String #213

Merged
merged 1 commit into from
Jun 29, 2018
Merged

Conversation

thoov
Copy link
Owner

@thoov thoov commented Jun 29, 2018

If the data is not an ArrayBuffer/Blog it should be serialized to
a string.

If the data is not an ArrayBuffer/Blog it should be serialized to
a string.
@thoov thoov merged commit 732a075 into master Jun 29, 2018
@thoov thoov deleted the serialize-send branch June 29, 2018 19:49
@thoov
Copy link
Owner Author

thoov commented Jun 29, 2018

Fixes: #212

@@ -0,0 +1,7 @@
export default function normalizeSendData(data) {
if (Object.prototype.toString.call(data) !== '[object Blob]' && !(data instanceof ArrayBuffer)) {
Copy link

@shanshanzhu shanshanzhu Dec 19, 2018

Choose a reason for hiding this comment

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

This works for us only when the mock-socket to be run in browser environment. In node, binary data can be instanceof Buffer
we should also check for !(data instanceof Buffer) to support mock-socket to be run in Node environment.

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.

2 participants