From dbe86d65622df1e302d1e64e2e8a5194070d36ec Mon Sep 17 00:00:00 2001 From: Jeevanandam M Date: Tue, 21 Mar 2023 01:59:47 -0700 Subject: [PATCH] feat: export NoRedirectPolicy error Signed-off-by: Jeevanandam M --- redirect.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/redirect.go b/redirect.go index 3b26eb2e..fdca9fe6 100644 --- a/redirect.go +++ b/redirect.go @@ -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 @@ -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 }) }