Skip to content

Commit

Permalink
feat: export NoRedirectPolicy error (#637)
Browse files Browse the repository at this point in the history
Signed-off-by: Jeevanandam M <jeeva@myjeeva.com>
  • Loading branch information
jeevatkm committed Mar 21, 2023
1 parent cf2d4c4 commit 15cedd4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion redirect.go
Expand Up @@ -12,6 +12,10 @@ import (
"strings"
)

var (
ErrAutoRedirectDisabled = errors.New("auto redirect is disabled")
)

type (
// RedirectPolicy to regulate the redirects in the resty client.
// Objects implementing the RedirectPolicy interface can be registered as
Expand All @@ -37,7 +41,7 @@ func (f RedirectPolicyFunc) Apply(req *http.Request, via []*http.Request) error
// resty.SetRedirectPolicy(NoRedirectPolicy())
func NoRedirectPolicy() RedirectPolicy {
return RedirectPolicyFunc(func(req *http.Request, via []*http.Request) error {
return errors.New("auto redirect is disabled")
return ErrAutoRedirectDisabled
})
}

Expand Down

0 comments on commit 15cedd4

Please sign in to comment.