Skip to content

Commit

Permalink
[enh] add accept request header
Browse files Browse the repository at this point in the history
closes #150
  • Loading branch information
asciimoo committed May 22, 2018
1 parent 9a176fe commit 061013b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions colly.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,11 @@ func (c *Collector) fetch(u, method string, depth int, requestData io.Reader, ct
if method == "POST" && req.Header.Get("Content-Type") == "" {
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
}

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

origURL := req.URL
response, err := c.backend.Cache(req, c.MaxBodySize, c.CacheDir)
if err := c.handleOnError(response, err, request, ctx); err != nil {
Expand Down

0 comments on commit 061013b

Please sign in to comment.