This commit is contained in:
crusader 2018-04-11 21:12:53 +09:00
parent 42d71182fc
commit 05c5f95a40

View File

@ -138,15 +138,10 @@ func (s *Server) httpHandler(ctx *fasthttp.RequestCtx) {
servlet Servlet
)
if !s.ServerHandler.CheckOrigin(ctx) {
s.onError(ctx, web.NewError(fasthttp.StatusForbidden, fmt.Errorf("Forbidden")))
if s.ServerHandler.CheckOrigin(ctx) {
return
}
if string(ctx.Method()) == "OPTIONS" && ctx.Request.Header.Peek("Access-Control-Request-Method") != nil {
ctx.SetStatusCode(fasthttp.StatusOK)
}
if servlet = s.ServerHandler.Servlet(s.ctx, ctx); nil == servlet {
s.onError(ctx, web.NewError(fasthttp.StatusNotFound, fmt.Errorf("Not Found")))
return