Source File
clone.go
Belonging Package
net/http
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package http
import (
)
func ( url.Values) url.Values {
if == nil {
return nil
}
// http.Header and url.Values have the same representation, so temporarily
// treat it like http.Header, which does have a clone:
return url.Values(Header().Clone())
}
func ( *url.URL) *url.URL {
if == nil {
return nil
}
:= new(url.URL)
* = *
if .User != nil {
.User = new(url.Userinfo)
*.User = *.User
}
return
}
func ( *multipart.Form) *multipart.Form {
if == nil {
return nil
}
:= &multipart.Form{
Value: (map[string][]string)(Header(.Value).Clone()),
}
if .File != nil {
:= make(map[string][]*multipart.FileHeader)
for , := range .File {
:= make([]*multipart.FileHeader, len())
for , := range {
[] = cloneMultipartFileHeader()
}
[] =
}
.File =
}
return
}
func ( *multipart.FileHeader) *multipart.FileHeader {
if == nil {
return nil
}
:= new(multipart.FileHeader)
* = *
.Header = textproto.MIMEHeader(Header(.Header).Clone())
return
}
// cloneOrMakeHeader invokes Header.Clone but if the
// result is nil, it'll instead make and return a non-nil Header.
func ( Header) Header {
:= .Clone()
if == nil {
= make(Header)
}
return
}
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |