Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/router/not_found_handler.go

27 lignes
591 o
Go
Brut Vue normale Historique

2017-05-07 08:59:45 +02:00
package router
import (
"net/http"
2017-05-17 07:58:40 +02:00
"github.com/NyaaPantsu/nyaa/util/languages"
2017-05-07 08:59:45 +02:00
"github.com/gorilla/mux"
)
func NotFoundHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusNotFound)
nftv := NotFoundTemplateVariables{
Navigation: NewNavigation(),
Search: NewSearchForm(),
T: languages.GetTfuncFromRequest(r),
User: GetUser(r),
URL: r.URL,
Route: mux.CurrentRoute(r),
}
err := notFoundTemplate.ExecuteTemplate(w, "index.html", nftv)
2017-05-07 08:59:45 +02:00
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}