Skip to content

Commit

Permalink
Support ArrayBufferViews in xhr.send()
Browse files Browse the repository at this point in the history
  • Loading branch information
ondras authored and domenic committed May 20, 2017
1 parent ce13678 commit 56fbd0d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/jsdom/living/xmlhttprequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,8 @@ module.exports = function createXMLHttpRequest(window) {
}
} else if (body instanceof ArrayBuffer) {
flag.body = new Buffer(new Uint8Array(body));
} else if (ArrayBuffer.isView(body)) {
flag.body = new Buffer(body.buffer, body.byteOffset, body.byteLength);
} else if (body instanceof Document.interface) {
if (body.childNodes.length === 0) {
throw new DOMException(DOMException.INVALID_STATE_ERR);
Expand Down
1 change: 1 addition & 0 deletions test/web-platform-tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ describe("Web Platform Tests", () => {
"XMLHttpRequest/send-content-type-charset.htm",
"XMLHttpRequest/send-content-type-string.htm",
"XMLHttpRequest/send-data-arraybuffer.htm",
"XMLHttpRequest/send-data-arraybufferview.htm",
"XMLHttpRequest/send-data-blob.htm",
"XMLHttpRequest/send-data-es-object.htm",
"XMLHttpRequest/send-data-formdata.htm",
Expand Down
2 changes: 1 addition & 1 deletion test/web-platform-tests/tests
Submodule tests updated from 0f26c4 to 8df7c9

0 comments on commit 56fbd0d

Please sign in to comment.