http-sync icon indicating copy to clipboard operation
http-sync copied to clipboard

Does not handle multiple header values

Open ahamid opened this issue 10 years ago • 1 comments

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

ahamid avatar Sep 11 '14 14:09 ahamid

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...

dhruvbird avatar Sep 26 '14 15:09 dhruvbird