Source File
httptest.go
Belonging Package
net/http/httptest
package httptest
import (
)
.Proto = "HTTP/1.1"
.ProtoMinor = 1
.Close = false
if != nil {
switch v := .(type) {
case *bytes.Buffer:
.ContentLength = int64(.Len())
case *bytes.Reader:
.ContentLength = int64(.Len())
case *strings.Reader:
.ContentLength = int64(.Len())
default:
.ContentLength = -1
}
if , := .(io.ReadCloser); {
.Body =
} else {
.Body = io.NopCloser()
}
}
.RemoteAddr = "192.0.2.1:1234"
if .Host == "" {
.Host = "example.com"
}
if strings.HasPrefix(, "https://") {
.TLS = &tls.ConnectionState{
Version: tls.VersionTLS12,
HandshakeComplete: true,
ServerName: .Host,
}
}
return
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin 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. |