resty icon indicating copy to clipboard operation
resty copied to clipboard

Feature Request: export `NoRedirectPolicy`'s error

Open trim21 opened this issue 2 years ago • 0 comments

this is what we do to know it's a redirect problem:

	resp, err := h.R().SetResult(&r).Get(...)
	if err != nil {
		if err.Error() == "auto redirect is disabled" {
			return APISubject{}, errSkip
		}
		panic(err)
	}

if the error of NoRedirectPolicy is exported, we can use errors.Is(err, resty.ErrNotAllowed) to match the error.

trim21 avatar Jul 28 '22 18:07 trim21