diff --git a/github/github.go b/github/github.go index 301887f..56a71ba 100644 --- a/github/github.go +++ b/github/github.go @@ -189,7 +189,7 @@ func newResponse(r *http.Response) *Response { func (r *Response) populatePageValues() { if links, ok := r.Response.Header["Link"]; ok && len(links) > 0 { for _, link := range strings.Split(links[0], ",") { - segments := strings.Split(link, ";") + segments := strings.Split(strings.TrimSpace(link), ";") // link must at least have href and rel if len(segments) < 2 { diff --git a/github/github_test.go b/github/github_test.go index 8d71141..401875d 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -134,9 +134,9 @@ func TestResponse_populatePageValues(t *testing.T) { r := http.Response{ Header: http.Header{ "Link": {`; rel="first",` + - `; rel="prev",` + - `; rel="next",` + - `; rel="last"`, + ` ; rel="prev",` + + ` ; rel="next",` + + ` ; rel="last"`, }, }, }