ekster/pkg/linkheader
Peter Stuifzand 9ef3369389
Some checks failed
continuous-integration/drone/push Build is failing
Cleanup for go modules
2020-07-27 22:09:02 +02:00
..
script Cleanup for go modules 2020-07-27 22:09:02 +02:00
.gitignore Cleanup for go modules 2020-07-27 22:09:02 +02:00
.travis.yml Cleanup for go modules 2020-07-27 22:09:02 +02:00
CONTRIBUTING.mkd Cleanup for go modules 2020-07-27 22:09:02 +02:00
examples_test.go Cleanup for go modules 2020-07-27 22:09:02 +02:00
LICENSE Cleanup for go modules 2020-07-27 22:09:02 +02:00
main_test.go Cleanup for go modules 2020-07-27 22:09:02 +02:00
main.go Cleanup for go modules 2020-07-27 22:09:02 +02:00
README.mkd Cleanup for go modules 2020-07-27 22:09:02 +02:00

Golang Link Header Parser

Library for parsing HTTP Link headers. Requires Go 1.6 or higher.

Docs can be found on the GoDoc page.

Build Status

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