2016-04-03 17:59:27 +00:00
|
|
|
package v1
|
|
|
|
|
|
|
|
import (
|
2017-02-02 12:40:28 +00:00
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
"github.com/valyala/fasthttp"
|
2019-02-23 13:11:47 +00:00
|
|
|
"github.com/osuYozora/api/common"
|
2016-04-03 17:59:27 +00:00
|
|
|
)
|
|
|
|
|
2016-04-16 16:05:24 +00:00
|
|
|
type response404 struct {
|
|
|
|
common.ResponseBase
|
|
|
|
Cats string `json:"cats"`
|
|
|
|
}
|
|
|
|
|
2016-04-03 17:59:27 +00:00
|
|
|
// Handle404 handles requests with no implemented handlers.
|
2017-02-02 12:40:28 +00:00
|
|
|
func Handle404(c *fasthttp.RequestCtx) {
|
|
|
|
c.Response.Header.Add("X-Real-404", "yes")
|
|
|
|
data, err := json.MarshalIndent(response404{
|
2016-04-16 16:05:24 +00:00
|
|
|
ResponseBase: common.ResponseBase{
|
2016-06-13 19:47:35 +00:00
|
|
|
Code: 404,
|
2016-04-16 16:05:24 +00:00
|
|
|
},
|
|
|
|
Cats: surpriseMe(),
|
2017-02-02 12:40:28 +00:00
|
|
|
}, "", "\t")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
c.SetStatusCode(404)
|
|
|
|
c.Write(data)
|
2016-04-03 17:59:27 +00:00
|
|
|
}
|