GetScheme returns the full scheme of the request URL (https://, http:// or ws:// and e.t.c.).
(r *http.Request)
| 940 | |
| 941 | // GetScheme returns the full scheme of the request URL (https://, http:// or ws:// and e.t.c.). |
| 942 | func GetScheme(r *http.Request) string { |
| 943 | scheme := r.URL.Scheme |
| 944 | |
| 945 | if scheme == "" { |
| 946 | if r.TLS != nil { |
| 947 | scheme = netutil.SchemeHTTPS |
| 948 | } else { |
| 949 | scheme = netutil.SchemeHTTP |
| 950 | } |
| 951 | } |
| 952 | |
| 953 | return scheme + sufscheme |
| 954 | } |
| 955 | |
| 956 | // Scheme returns the full scheme of the request (including :// suffix). |
| 957 | func (ctx *Context) Scheme() string { |