152
// decodeLink decodes the Nexus-Link header values.
153
// It must have the same format of HTTP Link header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Link
154
>
func decodeLink(encodedLink string) (nexus.Link, error) {
api.go
155
>
var link nexus.Link
156
>
encodedLink = strings.TrimSpace(encodedLink)
157
>
if len(encodedLink) == 0 {
158
return link, errors.New("failed to parse link header: value is empty")
159
}
160
161
>
if encodedLink[0] != '<' {
api.go
162
return link, fmt.Errorf("failed to parse link header: invalid format: %s", encodedLink)
163
}