response

package
v0.0.0-...-f5bbbf4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoopModifier = ModifierFunc(func(*http.Response) error { return nil })

Functions

func ReadJSON

func ReadJSON(resp *http.Response, msg interface{}) error

Types

type Modifier

type Modifier interface {
	Modify(*http.Response) error
}

Modifier is the interface that allows to modify http.http.Response the Respond method.

func BackendServer

func BackendServer() Modifier

BackendServer set "X-Backend-Server" header to the URL of the request

func CombineModifier

func CombineModifier(modifiers ...Modifier) Modifier

CombineModifier combines multiple modifiers into a single one

func GZIP

func GZIP() Modifier

func Headers

func Headers(overrides map[string][]string) Modifier

Headers sets or deletes custom request headers

func HeadersModifier

func HeadersModifier(h func(http.Header) error) Modifier

func Proxy

func Proxy(cfg *ProxyConfig) Modifier

Proxy creates a preparer for proxying request

type ModifierFunc

type ModifierFunc func(*http.Response) error

ModifierFunc is a method that implements the Modifier interface.

func (ModifierFunc) Modify

func (rf ModifierFunc) Modify(r *http.Response) error

Respond implements the Modifier interface on ModifierFunc.

type ProxyConfig

type ProxyConfig struct {
	Headers map[string][]string `json:"headers,omitempty"`
}

func (*ProxyConfig) SetDefault

func (cfg *ProxyConfig) SetDefault() *ProxyConfig

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL