Skip to content

File upload test - using assert.response #145

Open
gitfy opened this Issue Oct 25, 2011 · 2 comments

3 participants

@gitfy
gitfy commented Oct 25, 2011

Hi,
I am trying to find out a way to test an upload functionality in my app using the assert response.

I keep getting the socket hangup, might be because of some wrong headers i am setting.

Is there a sample, which i could use it as a reference.

Thanks.

@mmmmmm2
mmmmmm2 commented Oct 25, 2011

Expresso doesn't support the continue event on a request, so I had to modify it to work with it. Please take a look at mmmmmm2/expresso@3f13a95 for my quick patch.

Then in the assert.response you need to set a header like this 'Expect': '100-continue'

If you are doing a multipart/form-data upload, then you will also need to manually get the Content-Type and Content-Length headers added as well. And then make sure the body of the request conforms with the way multipart/form-data uploads are expected... just google around for that if you need to.

@tj
Sloth member
tj commented Oct 25, 2011

when I have time im going to adapt superagent for testing frameworks, it'll be much more flexible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.