You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create your middleware that will customize HTTP User-Agent header.
typeUserAgentstruct{
next antch.HttpMessageHandler
}
func (ua*UserAgent) Send(req*http.Request) (*http.Response, error){
req.Header.Set("User-Agent","antbot")
// passed req to the next middleware.returnua.next.Send(req)
}
Next is to register your middleware to crawler via UseMiddleware().