Skip to content

x/net/http/httpguts: add ParseCookie and ParseSetCookie #25194

Closed
@posener

Description

@posener

What version of Go are you using (go version)?

go version go1.10 linux/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

I wanted to extract cookies struct from a cookie header string.
I had to type this piece of code:

req := http.Request{Header: http.Header{"Cookie": []string{raw}}}
cookies := req.Cookies()

It felt kind of workaround.

What did you expect to see?

Have the appropriate method in the net/http package that is public and parses cookie headers to a []*Cookie struct.
For example:

func ParseCookies(raw string) []*Cookie {
    ...
}

What did you see instead?

Nothing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions