gentleman.v2: gopkg.in/h2non/gentleman.v2/plugins/redirect Index | Files

package redirect

import "gopkg.in/h2non/gentleman.v2/plugins/redirect"

Index

Package Files

redirect.go

Variables

var (
    // ErrRedirectLimitExceeded is the error returned when the request responded
    // with too many redirects
    ErrRedirectLimitExceeded = errors.New("gentleman: Request exceeded redirect count")

    // RedirectLimit defines the maximum number of redirects to follow in a request
    RedirectLimit = 10

    // SensitiveHeaders is a map of sensitive HTTP headers that a user
    // doesn't want passed on a redirect. This is the global variable
    SensitiveHeaders = []string{
        "WWW-Authenticate",
        "Authorization",
        "Proxy-Authorization",
    }
)

func Config Uses

func Config(opts Options) p.Plugin

Config defines in the request http.Client the redirect policy based on the given options.

func Limit Uses

func Limit(limit int) p.Plugin

Limit defines in the maximum number of redirects that http.Client should follow.

type Options Uses

type Options struct {
    // Limit is the acceptable amount of redirects that we should expect
    // before returning an error be default this is set to 30. You can change this
    // globally by modifying the `Limit` variable
    Limit int

    // Trusted is a flag that will enable all headers to be
    // forwarded to the redirect location. Otherwise, the headers specified in
    // `SensitiveHeaders` will be removed from the request
    Trusted bool

    // SensitiveHeaders is a map of sensitive HTTP headers that a user
    // doesn't want passed on a redirect
    SensitiveHeaders []string
}

Options store the redirect policy options

Package redirect imports 5 packages (graph). Updated 2020-02-22. Refresh now. Tools for package owners.