assaf/zombie — Issue #234: multipart/form-data form with multiselect
Author: everzet
Created: 2011-12-20 12:30:29+00:00
State: open

`zombie@0.12.7` in `v0.6.5+` always throws an `TypeError: first argument must be a string or Buffer` exception, when you're trying to submit form with `enctype="multipart/form-data"`, that has `` in it.

Example to reproduce:

``` js
var zombie = require('zombie')
, browser = new zombie.Browser();

browser.visit('http://test.mink.dev/zombie_bug.html', function() {
browser.fill('first_name', 'Konstantin');
browser.pressButton('submit', function() {
// never executed because of exception
});
});
```

``` html

Multipart form with multiselect

one

two

three

```

It always throws:

``` bash
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: first argument must be a string or Buffer
at ClientRequest.write (http.js:601:11)
at Resources._makeRequest (/usr/local/lib/node_modules/zombie/lib/zombie/resources.coffee:316:26)
at /usr/local/lib/node_modules/zombie/lib/zombie/resources.coffee:136:22
at EventLoop.perform (/usr/local/lib/node_modules/zombie/lib/zombie/eventloop.coffee:116:7)
at Resources.request (/usr/local/lib/node_modules/zombie/lib/zombie/resources.coffee:135:39)
at History._resource (/usr/local/lib/node_modules/zombie/lib/zombie/history.coffee:120:38)
at History._submit (/usr/local/lib/node_modules/zombie/lib/zombie/history.coffee:239:19)
at /usr/local/lib/node_modules/zombie/lib/zombie/forms.coffee:63:24
at /usr/local/lib/node_modules/zombie/lib/zombie/forms.coffee:59:16
at /usr/local/lib/node_modules/zombie/lib/zombie/forms.coffee:59:16
```

If you remove either `enctype="multipart/form-data"` from form OR `multiple="multiple"` bug disappears, but together - they simply don't work.