Skip to content
This repository

File upload test - using assert.response #145

Open
gitfy opened this Issue · 2 comments

3 participants

Lenin Jon Keating TJ Holowaychuk
Lenin

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.

Jon Keating

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 mathrawka/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 Holowaychuk
Owner

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.