From fefe56aa016ef483de541d60f4c6b971eeebf885 Mon Sep 17 00:00:00 2001 From: Yann Malet Date: Sun, 4 Aug 2013 11:52:03 +0200 Subject: [PATCH] Trim space around link header values ref #22 --- github/github.go | 2 +- github/github_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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"`, }, }, }