Added a 404 path for assets that doesn't render the full template
This commit is contained in:
parent
94bd05751e
commit
0da3a1ffb9
|
@ -166,16 +166,21 @@ func ProjectCSS(c *RequestContext) ResponseData {
|
||||||
}
|
}
|
||||||
|
|
||||||
func FourOhFour(c *RequestContext) ResponseData {
|
func FourOhFour(c *RequestContext) ResponseData {
|
||||||
templateData := struct {
|
|
||||||
templates.BaseData
|
|
||||||
Wanted string
|
|
||||||
}{
|
|
||||||
BaseData: getBaseData(c),
|
|
||||||
Wanted: c.FullUrl(),
|
|
||||||
}
|
|
||||||
var res ResponseData
|
var res ResponseData
|
||||||
res.StatusCode = http.StatusNotFound
|
res.StatusCode = http.StatusNotFound
|
||||||
res.WriteTemplate("404.html", templateData, c.Perf)
|
|
||||||
|
if c.Req.Header["Accept"] != nil && strings.Contains(c.Req.Header["Accept"][0], "text/html") {
|
||||||
|
templateData := struct {
|
||||||
|
templates.BaseData
|
||||||
|
Wanted string
|
||||||
|
}{
|
||||||
|
BaseData: getBaseData(c),
|
||||||
|
Wanted: c.FullUrl(),
|
||||||
|
}
|
||||||
|
res.WriteTemplate("404.html", templateData, c.Perf)
|
||||||
|
} else {
|
||||||
|
res.Write([]byte("Not Found"))
|
||||||
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue