Refactor more, add scrape tests

This commit is contained in:
Justin Li
2014-07-15 21:07:33 -04:00
parent bec70e9759
commit 586b6852de
4 changed files with 152 additions and 41 deletions

View File

@@ -281,11 +281,11 @@ func NewScrape(cfg *config.Config, r *http.Request, p httprouter.Params) (*Scrap
}
if q.Infohashes == nil {
if _, exists := q.Params["infohash"]; !exists {
if _, exists := q.Params["info_hash"]; !exists {
// There aren't any infohashes.
return nil, ErrMalformedRequest
}
q.Infohashes = []string{q.Params["infohash"]}
q.Infohashes = []string{q.Params["info_hash"]}
}
return &Scrape{