-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathnoctx.go
30 lines (24 loc) · 808 Bytes
/
noctx.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// +build !go1.7
package rest
import "net/http"
// CtxErr returns an error that's been stored in the Request context. This is
// a no-op in older versions of Go.
func CtxErr(r *http.Request) error {
return nil
}
// ctxSetErr sets err in the request context, and returns the new request.
func ctxSetErr(r *http.Request, err error) *http.Request {
Logger.Info("cannot set error in context", "err", err)
return r
}
// CtxDomain returns a domain that's been set on the request. This is a no-op
// in older versions of Go.
func CtxDomain(r *http.Request) string {
return ""
}
// ctxSetDomain sets a domain in the request context, and returns the new
// request.
func ctxSetDomain(r *http.Request, domain string) *http.Request {
Logger.Info("cannot set domain in context", "domain", domain)
return r
}