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

Does not handle multiple header values #31

Open
ahamid opened this issue Sep 11, 2014 · 1 comment
Open

Does not handle multiple header values #31

ahamid opened this issue Sep 11, 2014 · 1 comment

Comments

@ahamid
Copy link
Contributor

ahamid commented Sep 11, 2014

Only the last value of a given multi-valued response header is saved. For example:

Set-Cookie: first cookie
Set-Cookie: second cookie

only the second cookie will be assigned. This is done by the following code:

_m = line.match(_hre);
if (_m) {
  _h[_m[1]] = _m[3];
}

it should probably be something like:

_m = line.match(_hre);
if (_m) {
  _h[_m[1]] = _h[_m[1]] || [];
  _h[_m[1]].push(_m[3]);
}

and headers will be multi-valued

@dhruvbird
Copy link
Owner

Thanks for the PR!! Is there some way to test this? Do you know any external service that sends multiple responses this way? If not, I think it should be easy enough to start an HTTP server in the test file and return multiple headers - dunno...

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