Skip to content

Commit

Permalink
put accept header before OnRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
k4lizen committed Oct 3, 2023
1 parent a6e3d81 commit 693a39f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions colly.go
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,10 @@ func (c *Collector) fetch(u, method string, depth int, requestData io.Reader, ct
ID: atomic.AddUint32(&c.requestCount, 1),
}

if req.Header.Get("Accept") == "" {
req.Header.Set("Accept", "*/*")
}

c.handleOnRequest(request)

if request.abort {
Expand All @@ -681,10 +685,6 @@ func (c *Collector) fetch(u, method string, depth int, requestData io.Reader, ct
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
}

if req.Header.Get("Accept") == "" {
req.Header.Set("Accept", "*/*")
}

var hTrace *HTTPTrace
if c.TraceHTTP {
hTrace = &HTTPTrace{}
Expand Down

0 comments on commit 693a39f

Please sign in to comment.