Skip to content

Commit

Permalink
Fix export CreateFormReader function
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinku-Chen committed Oct 25, 2024
1 parent 5224b97 commit 03c5a5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions colly.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ func (c *Collector) Head(URL string) error {
// Post starts a collector job by creating a POST request.
// Post also calls the previously provided callbacks
func (c *Collector) Post(URL string, requestData map[string]string) error {
return c.scrape(URL, "POST", 1, createFormReader(requestData), nil, nil, true)
return c.scrape(URL, "POST", 1, CreateFormReader(requestData), nil, nil, true)
}

// PostRaw starts a collector job by creating a POST request with raw binary data.
Expand Down Expand Up @@ -1425,7 +1425,7 @@ func (c *Collector) parseSettingsFromEnv() {
}

func (c *Collector) checkHasVisited(URL string, requestData map[string]string) (bool, error) {
hash := requestHash(URL, createFormReader(requestData))
hash := requestHash(URL, CreateFormReader(requestData))
return c.store.IsVisited(hash)
}

Expand All @@ -1444,7 +1444,7 @@ func SanitizeFileName(fileName string) string {
), "-", "_", -1)
}

func createFormReader(data map[string]string) io.Reader {
func CreateFormReader(data map[string]string) io.Reader {

Check failure on line 1447 in colly.go

View workflow job for this annotation

GitHub Actions / Build 1.22

exported function CreateFormReader should have comment or be unexported

Check failure on line 1447 in colly.go

View workflow job for this annotation

GitHub Actions / Test 1.22

exported function CreateFormReader should have comment or be unexported

Check failure on line 1447 in colly.go

View workflow job for this annotation

GitHub Actions / Build 1.21

exported function CreateFormReader should have comment or be unexported

Check failure on line 1447 in colly.go

View workflow job for this annotation

GitHub Actions / Test 1.21

exported function CreateFormReader should have comment or be unexported

Check failure on line 1447 in colly.go

View workflow job for this annotation

GitHub Actions / Build 1.20

exported function CreateFormReader should have comment or be unexported

Check failure on line 1447 in colly.go

View workflow job for this annotation

GitHub Actions / Test 1.20

exported function CreateFormReader should have comment or be unexported

Check failure on line 1447 in colly.go

View workflow job for this annotation

GitHub Actions / Build 1.19

exported function CreateFormReader should have comment or be unexported

Check failure on line 1447 in colly.go

View workflow job for this annotation

GitHub Actions / Test 1.19

exported function CreateFormReader should have comment or be unexported
form := url.Values{}
for k, v := range data {
form.Add(k, v)
Expand Down
2 changes: 1 addition & 1 deletion request.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (r *Request) HasVisited(URL string) (bool, error) {
// of the previous request.
// Post also calls the previously provided callbacks
func (r *Request) Post(URL string, requestData map[string]string) error {
return r.collector.scrape(r.AbsoluteURL(URL), "POST", r.Depth+1, createFormReader(requestData), r.Ctx, nil, true)
return r.collector.scrape(r.AbsoluteURL(URL), "POST", r.Depth+1, CreateFormReader(requestData), r.Ctx, nil, true)
}

// PostRaw starts a collector job by creating a POST request with raw binary data.
Expand Down

0 comments on commit 03c5a5a

Please sign in to comment.