2018-12-26 16:17:37 +00:00
|
|
|
// +build go1.6
|
|
|
|
|
|
|
|
package swift
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
const IS_AT_LEAST_GO_16 = true
|
|
|
|
|
|
|
|
func SetExpectContinueTimeout(tr *http.Transport, t time.Duration) {
|
|
|
|
tr.ExpectContinueTimeout = t
|
|
|
|
}
|
|
|
|
|
|
|
|
func AddExpectAndTransferEncoding(req *http.Request, hasContentLength bool) {
|
2019-03-19 13:27:46 +00:00
|
|
|
if req.Body != nil {
|
|
|
|
req.Header.Add("Expect", "100-continue")
|
|
|
|
}
|
2018-12-26 16:17:37 +00:00
|
|
|
if !hasContentLength {
|
|
|
|
req.TransferEncoding = []string{"chunked"}
|
|
|
|
}
|
|
|
|
}
|