We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
func TestRedirectErrorRetry(t *testing.T) { ts := newTestServer() defer ts.Close() c := NewCollector() c.OnError(func(r *Response, err error) { if r.Ctx.Get("notFirst") == "" { r.Ctx.Put("notFirst", "first") _ = r.Request.Retry() return } t.Error("loop") }) c.OnResponse(func(response *Response) { println(1) }) c.Visit(ts.URL + "/redirected/") c.Visit(ts.URL + "/redirect") }
The text was updated successfully, but these errors were encountered:
add config
c.OnError(func(response *colly.Response, err error) { var alreadyVisitedError *colly.AlreadyVisitedError if errors.As(err, &alreadyVisitedError) { response.Request.URL = &url.URL{} //防止在retry的时候出现已经访问的错误 } })
to forbidden retry a Visited url
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: