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