From 515478425457301f558215663ea727f278de9e02 Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 11 Apr 2018 20:34:45 +0900 Subject: [PATCH] ing --- web/fasthttp/server.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/fasthttp/server.go b/web/fasthttp/server.go index 9d7ce59..1553b9a 100644 --- a/web/fasthttp/server.go +++ b/web/fasthttp/server.go @@ -138,10 +138,15 @@ func (s *Server) httpHandler(ctx *fasthttp.RequestCtx) { servlet Servlet ) + 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 } + servletCtx := servlet.ServletCtx(s.ctx) if err := servlet.Handle(servletCtx, ctx); nil != err {