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 {