http-sync
http-sync copied to clipboard
Does not handle multiple header values
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
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...