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

Bug with case sensitivity and HEAD requests #353

Closed
rchadwic opened this issue Jul 1, 2016 · 1 comment
Closed

Bug with case sensitivity and HEAD requests #353

rchadwic opened this issue Jul 1, 2016 · 1 comment

Comments

@rchadwic
Copy link

rchadwic commented Jul 1, 2016

We have a fairly specific bug, but it's reproducible, and I think we have a proposed solution.

First - to recreate the bug: Make a HEAD request to a server running GZIP compression in Node > 5.6. We get an "unexpected end of file" error.

We've traced this down a bit, and it seems to be related to the case sensitivity of the method on line 29 in lib/test.js. Supertest-as-promised forces us to use a lowercase 'head' here.

In SuperAgent, in lib/node/index.js there is are several case sensitive comparisons to "HEAD". This check is missed because of the case issue. On Node LTS, or on Node > 5.x but from a server without GZIP, missing this code path does not throw an exception. On Node > 5.x, when the server does use GZIP, missing this code path causes an exception.

Could we perhaps add a .toUpperCase() on method in lib/test.js?

If that's not possible, I might explore requesting a refactor of supertest-as-promised, but it appears that would be a lot harder.

Any thoughts? I know this is super specific, but it's really problem for us.

@mikelax
Copy link
Contributor

mikelax commented Oct 26, 2016

@rchadwic this should be addressed in v2.0.1 in #371. Can you try upgrading and seeing if that resolves the issue for you?

@mikelax mikelax closed this as completed Oct 26, 2016
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

2 participants