Created
September 16, 2016 13:43
-
-
Save fsamin/45f31d2f87caea381ef448572d5b1127 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func getNextPage(headers http.Header) string { | |
linkHeader := headers.Get("Link") | |
if linkHeader != "" { | |
links := strings.Split(linkHeader, ",") | |
for _, link := range links { | |
if strings.Contains(link, "rel=\"next\"") { | |
r, _ := regexp.Compile("<(.*)>.*") | |
s := r.FindStringSubmatch(link) | |
if len(s) == 2 { | |
return s[1] | |
} | |
break | |
} | |
} | |
} | |
return "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment