Open shinebayar-g opened 2 years ago
Have you tried using r.Request.Headers instead? r.Headers is the response header instead of the request header
collector.OnRequest(func(r *colly.Request) {
log.Println("headers:", r.Headers)
})
Function already takes a colly.Request
object. Hence r.Request.Headers
is not a valid code.
These cookies are set from storage in the http client when http client Do function is called. So it works really, but not exist in colly.Request . You can get it from the collector itself.
collector.OnRequest(func(r *colly.Request) {
cookies := collector.Cookies("example.com")
})
Hi. First of all, thank you for the awesome work!
I just noticed
collector.SetCookies()
method isn't setting any header.Example:
prints only:
No
Cookie
header was added. For now, I'm settingCookie
header manually.