func (n navigator) Location(resp *http.Response) (navigator, error) {
	_, exists := resp.Header["Location"]
	if !exists {
		return n, fmt.Errorf("Response didn't contain a Location header")
	}
	loc := resp.Header.Get("Location")
	lurl, err := makeAbsoluteIfNecessary(loc, n.rootUri)
	if err != nil {
		return n, err
	}
	return navigator{
		HttpClient: n.HttpClient,
		path:       []relation{},
		rootUri:    lurl,
	}, nil
}
Location follows the Location header from a response.  It makes the URI
absolute, if necessary.
package halgo
import (
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"net/url"
	"strings"
)
func Navigator(uri string) navigator {
	return navigator{
		rootUri:    uri,
		path:       []relation{},
		HttpClient: http.DefaultClient,
	}
}
type relation struct {
	rel    string
	params P
}
type navigator struct {
	HttpClient HttpClient
	path []relation
	rootUri string
}
func (n navigator) Follow(rel string) navigator {
	return n.Followf(rel, nil)
}
func (n navigator) Followf(rel string, params P) navigator {
	relations := append([]relation{}, n.path...)
	relations = append(relations, relation{rel: rel, params: params})
	return navigator{
		HttpClient: n.HttpClient,
		path:       relations,
		rootUri:    n.rootUri,
	}
}