refactor: move request related utilities to own pkg

This commit is contained in:
Trong Huu Nguyen
2021-10-06 12:39:08 +02:00
parent fb4adc9cc5
commit 7979bb09fb
10 changed files with 67 additions and 79 deletions

View File

@@ -2,7 +2,7 @@ package errorhandler
import (
"github.com/go-chi/chi/v5/middleware"
"github.com/nais/wonderwall/pkg/url"
"github.com/nais/wonderwall/pkg/request"
"html/template"
"net/http"
@@ -21,7 +21,7 @@ func respondError(w http.ResponseWriter, r *http.Request, statusCode int, cause
t, _ := template.ParseFiles("templates/error.html")
errorPage := ErrorPage{
CorrelationID: middleware.GetReqID(r.Context()),
CanonicalRedirectURL: url.CanonicalRedirectURL(r),
CanonicalRedirectURL: request.CanonicalRedirectURL(r),
}
t.Execute(w, errorPage)
}