visionmedia/superagent — Issue #35: Problem with passing an Array as data
Author: molnarg
Created: 2011-11-25 11:33:22+00:00
State: open

Superagent cannot handle Array as data parameter. In node.js, it throws this error:

TypeError: Second argument should be a buffer
at Socket._writeImpl (net.js:159:14)
at Socket._writeOut (net.js:444:25)
at Socket.flush (net.js:523:24)
at Socket._onWritable (net.js:603:12)
at Socket._onConnect (net.js:591:12)
at IOWatcher.onWritable [as callback] (net.js:186:12)

In the browser there is a problem with the JSON serialization: if the data parameter is `[1,2,3]`, the data sent is `"1,2,3"` instead of `"[1,2,3]"`