func Middleware(h http.HandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		if shouldSetToken(r) {
			token, err := auth.AuthenticityToken(w, r)
			if err != nil {
				log.Error(log.Values{"msg": "session: problem setting token", "error": err})
			} else {
				ctx := r.Context()
				ctx = context.WithValue(ctx, view.AuthenticityContext, token)
				r = r.WithContext(ctx)
			}
		}
		h(w, r)
	}
}
Middleware sets a token on every GET request so that it can be
inserted into the view. It currently ignores requests for files and assets.
package session
import (
	"context"
	"net/http"
	"strings"
	"github.com/fragmenta/auth"
	"github.com/fragmenta/server/log"
	"github.com/fragmenta/view"
)