diff --git a/benchmarks/golang-fasthttp/micro.go b/benchmarks/golang-fasthttp/micro.go index 8961104..97b1c2d 100644 --- a/benchmarks/golang-fasthttp/micro.go +++ b/benchmarks/golang-fasthttp/micro.go @@ -3,9 +3,8 @@ package main import "github.com/valyala/fasthttp" func hello(ctx *fasthttp.RequestCtx) { - if string(ctx.Path()) != "/" { - ctx.SetStatusCode(404) - ctx.WriteString("Not Found") + if len(ctx.Path()) != 1 { + ctx.Error("Not Found", fasthttp.StatusNotFound) return } ctx.WriteString("Hello world!") diff --git a/benchmarks/golang/micro.go b/benchmarks/golang/micro.go index 52062c6..6d236a6 100644 --- a/benchmarks/golang/micro.go +++ b/benchmarks/golang/micro.go @@ -8,9 +8,8 @@ var ( ) func hello(w http.ResponseWriter, r *http.Request) { - if r.URL.Path != "/" { - w.WriteHeader(http.StatusNotFound) - w.Write(notFoundResp) + if len(r.URL.Path) != 1 { + http.NotFound(w, r) return } w.Write(helloResp)