h2non / gock

HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽

Home Page:https://pkg.go.dev/github.com/h2non/gock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple response headers with same name are not set on http response

steinfletcher opened this issue · comments

commented

I am trying to set multiple cookies with the same name on the gock response, but it always seems to only set the first cookie on the response object.

Am I doing something wrong - is there a better way to set cookies?

The mergeHeaders function appears to be the culprit. I have a solution and test here: steinfletcher@75ea39d

Thanks

commented

Right, in such case multiple headers should exist with the same key. Would you mind sending a PR? Thank you.

commented

Submitted PR, but a test fails in CI that I can't reproduce locally. Seems unrelated. It looks like tip fails, but tests run fine for me on go 1.11 (stable). Might be an option to run against stable instead of tip, but interesting that tip fails.

Many thanks.

commented

Thanks for the PR!

New patch version is now available. Try upgrading the package.

commented

Thanks @h2non!