2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-13 00:36:35 +00:00
restic/vendor/github.com/ncw/swift/compatibility_1_6.go

24 lines
418 B
Go
Raw Normal View History

2019-01-27 20:07:57 +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-04-24 10:32:52 +00:00
if req.Body != nil {
req.Header.Add("Expect", "100-continue")
}
2019-01-27 20:07:57 +00:00
if !hasContentLength {
req.TransferEncoding = []string{"chunked"}
}
}