https://github.com/tomnomnom/linkheader
Golang HTTP Link header parser
https://github.com/tomnomnom/linkheader
Last synced: about 1 year ago
JSON representation
Golang HTTP Link header parser
- Host: GitHub
- URL: https://github.com/tomnomnom/linkheader
- Owner: tomnomnom
- License: mit
- Created: 2015-12-10T14:34:55.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-09-13T16:41:29.000Z (almost 3 years ago)
- Last Synced: 2025-04-12T23:38:59.081Z (about 1 year ago)
- Language: Go
- Size: 14.6 KB
- Stars: 96
- Watchers: 5
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.mkd
- Contributing: CONTRIBUTING.mkd
- License: LICENSE
Awesome Lists containing this project
README
# Golang Link Header Parser
Library for parsing HTTP Link headers. Requires Go 1.6 or higher.
Docs can be found on [the GoDoc page](https://godoc.org/github.com/tomnomnom/linkheader).
[](https://travis-ci.org/tomnomnom/linkheader)
## Basic Example
```go
package main
import (
"fmt"
"github.com/tomnomnom/linkheader"
)
func main() {
header := "; rel=\"next\"," +
"; 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
```