visionmedia/superagent — Issue #30: Misbehavior of parameters & form-data
Author: Nican
Created: 2011-11-05 20:46:36+00:00
State: open

I encountered a couple of an odd behavior when dealing with special parameters and form-data. Here is the source code:

```javascript
var superagent = require("superagent");
var fs = require('fs');

var req = superagent.get("http://example.com/test?abc=def");
req.request().assignSocket(fs.createWriteStream("./rwparams.txt"));
req.end();

var req = superagent.post("http://example.com/test?abc=def");
req.type('form-data')
req.data({"a":"1","b":2})
req.request().assignSocket(fs.createWriteStream("./rwparams2.txt"));
req.end();
```

Output of rwparams.txt:

```javascript
GET /test HTTP/1.1
Host: example.com
Connection: close
```
The parameter "abc=def" is just gone.

Output of rwparams2.txt:

```javascript
POST /test HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 5
Connection: close

a=1&b
```
the variable "b" no longer has a value. At least it could throw an error that it has invalid input.