File: compatibility_1_6.go

package info (click to toggle)
golang-github-ncw-swift 1.0.52-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, experimental, sid
  • size: 412 kB
  • sloc: python: 29; sh: 18; makefile: 4
file content (23 lines) | stat: -rw-r--r-- 418 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// +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) {
	if req.Body != nil {
		req.Header.Add("Expect", "100-continue")
	}
	if !hasContentLength {
		req.TransferEncoding = []string{"chunked"}
	}
}