Skip to content

Instantly share code, notes, and snippets.

@jonnyreeves
Created February 4, 2016 09:50
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jonnyreeves/17f91155a0d4a5d296d6 to your computer and use it in GitHub Desktop.
Save jonnyreeves/17f91155a0d4a5d296d6 to your computer and use it in GitHub Desktop.
Testing Cookie Writes in Golang
@bronger
Copy link

bronger commented Nov 3, 2016

In line 14, a " is missing.

@mfhholmes
Copy link

or you could just look at recorder.Result().Cookies()

@Justin2997
Copy link

Justin2997 commented Jun 25, 2020

This solution is not adapter for new version of golang. You will have :

recorder.HeaderMap is deprecated: HeaderMap exists for historical compatibility and should not be used. To access the headers returned by a handler, use the Response.Header map as returned by the Result method.

You should use :
recorder.Result().Cookies()[0] as @mfhholmes mentionne.

You can get the value with : recorder.Result().Cookies()[0].Value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment