Supertest: POST request with attach() and send() fails

Created on 12 Mar 2014  路  1Comment  路  Source: visionmedia/supertest

Using attach() and send() on the same request results in a parse error from Formidable. Seems to be related to boudary token somehow. Maybe I'm holding it wrong. I was unable to make a proper multipart request - file uploads only worked when not using send().

Most helpful comment

I think what your looking for is .field()

request(app)
.post('/')
.field('foo', 'bar')
.attach('text', __dirname + '/fixtures/data.txt')
.end(done);

Check out "field values" on the superagent docs. http://visionmedia.github.io/superagent/#multipart-requests

>All comments

I think what your looking for is .field()

request(app)
.post('/')
.field('foo', 'bar')
.attach('text', __dirname + '/fixtures/data.txt')
.end(done);

Check out "field values" on the superagent docs. http://visionmedia.github.io/superagent/#multipart-requests

Was this page helpful?
0 / 5 - 0 ratings

Related issues

schm1ty1 picture schm1ty1  路  4Comments

mickaeltr picture mickaeltr  路  3Comments

nareshbhatia picture nareshbhatia  路  6Comments

DeaconDesperado picture DeaconDesperado  路  6Comments

jon301 picture jon301  路  5Comments