You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
7293d6029b | 1 year ago | |
---|---|---|
.. | ||
.gitignore | 1 year ago | |
.travis.yml | 1 year ago | |
CONTRIBUTING.mkd | 1 year ago | |
LICENSE | 1 year ago | |
README.mkd | 1 year ago | |
main.go | 1 year ago |
README.mkd
Golang Link Header Parser
Library for parsing HTTP Link headers. Requires Go 1.6 or higher.
Docs can be found on the GoDoc page.
Basic Example
package main
import (
"fmt"
"github.com/tomnomnom/linkheader"
)
func main() {
header := "<https://api.github.com/user/58276/repos?page=2>; rel=\"next\"," +
"<https://api.github.com/user/58276/repos?page=2>; rel=\"last\""
links := linkheader.Parse(header)
for _, link := range links {
fmt.Printf("URL: %s; Rel: %s\n", link.URL, link.Rel)
}
}
// Output:
// URL: https://api.github.com/user/58276/repos?page=2; Rel: next
// URL: https://api.github.com/user/58276/repos?page=2; Rel: last