Documentation ¶
Overview ¶
* Copyright 2020 The Compass Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
- Constants
- func HeaderForwarder(forwardHeaders []string) func(next http.Handler) http.Handler
- func LoadFromContext(ctx context.Context) (map[string]string, error)
- func NewClient(timeout time.Duration, transport http.RoundTripper) *http.Client
- func NewHTTPTransport(config *Config) *http.Transport
- func SaveToContext(ctx context.Context, key, val string) context.Context
- func UnauthorizedMiddleware() func(next http.Handler) http.Handler
- type Client
- type Config
- type Token
Constants ¶
const HeadersContextKey key = iota
Variables ¶
This section is empty.
Functions ¶
func HeaderForwarder ¶
HeaderForwarder stores the specified request headers in the context so that they can later be used and forwarded to other backends
func NewHTTPTransport ¶
Types ¶
type Config ¶
type Config struct { Timeout time.Duration `` /* 167-byte string literal not displayed */ TLSHandshakeTimeout time.Duration `mapstructure:"tls_handshake_timeout"` IdleConnTimeout time.Duration `mapstructure:"idle_conn_timeout"` ResponseHeaderTimeout time.Duration `mapstructure:"response_header_timeout"` DialTimeout time.Duration `mapstructure:"dial_timeout"` ExpectContinueTimeout time.Duration `mapstructure:"expect_continue_timeout"` MaxIdleConns int `mapstructure:"max_idle_cons"` SkipSSLValidation bool `mapstructure:"skip_ssl_validation" description:"whether to skip ssl verification when making calls to external services"` ForwardHeaders []string `mapstructure:"forward_headers"` }
func DefaultConfig ¶
func DefaultConfig() *Config