Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File upload test - using assert.response #145

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

File upload test - using assert.response #145

gitfy opened this issue Oct 25, 2011 · 2 comments

Comments

@gitfy
Copy link

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.

@emostar
Copy link

emostar 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 emostar/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
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants