Skip to content

Commit 46e2b84

Browse files
author
James Halliday
committed
handler for *Array types
1 parent f9a2bf6 commit 46e2b84

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/request.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,22 @@ Request.prototype.end = function (s) {
9494
}
9595
this.xhr.send(body);
9696
}
97+
else if (/Array/.test(Object.prototype.toString.call(this.body[0]))) {
98+
var len = 0;
99+
for (var i = 0; i < this.body.length; i++) {
100+
len += this.body[i].length;
101+
}
102+
var body = new(this.body[0].constructor)(len);
103+
var k = 0;
104+
105+
for (var i = 0; i < this.body.length; i++) {
106+
var b = this.body[i];
107+
for (var j = 0; j < b.length; j++) {
108+
body[k++] = b[j];
109+
}
110+
}
111+
this.xhr.send(body);
112+
}
97113
else {
98114
var body = '';
99115
for (var i = 0; i < this.body.length; i++) {

0 commit comments

Comments
 (0)