MCPcopy Index your code
hub / github.com/imroc/req / MaxRedirectPolicy

Function MaxRedirectPolicy

redirect.go:15–22  ·  view source on GitHub ↗

MaxRedirectPolicy specifies the max number of redirect

(noOfRedirect int)

Source from the content-addressed store, hash-verified

13
14// MaxRedirectPolicy specifies the max number of redirect
15func MaxRedirectPolicy(noOfRedirect int) RedirectPolicy {
16 return func(req *http.Request, via []*http.Request) error {
17 if len(via) >= noOfRedirect {
18 return fmt.Errorf("stopped after %d redirects", noOfRedirect)
19 }
20 return nil
21 }
22}
23
24// DefaultRedirectPolicy allows up to 10 redirects
25func DefaultRedirectPolicy() RedirectPolicy {

Callers 2

DefaultRedirectPolicyFunction · 0.85
TestRedirectFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by 1

TestRedirectFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…