Skip to content

net/http: Header.Clone behavior #33141

Closed
Closed
@dsnet

Description

@dsnet

The Header.Clone method is being added in Go1.13. It's current behavior is to always allocate a map and return it even if the receiver is nil.

Thus:

h1 := http.Header(nil)
h2 := h1.Clone()
fmt.Println(h1 == nil) // true
fmt.Println(h2 == nil) // false

Is this behavior we want to go with? It seems more consistent for Clone to return nil if the receiver is also nil.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions