diff options
author | Aliaksandr Valialkin <valyala@gmail.com> | 2015-11-14 17:58:58 +0200 |
---|---|---|
committer | Aliaksandr Valialkin <valyala@gmail.com> | 2015-11-14 17:58:58 +0200 |
commit | 2e78d83bf71e3356973113551de03f234a8f8095 (patch) | |
tree | 41be20adaa96de406670b7260bff0e909aba95d4 /client_timing_test.go | |
parent | Substituted direct access to Request.Method by accessors, so package users do... (diff) | |
download | fasthttp-2e78d83bf71e3356973113551de03f234a8f8095.tar.gz fasthttp-2e78d83bf71e3356973113551de03f234a8f8095.tar.bz2 fasthttp-2e78d83bf71e3356973113551de03f234a8f8095.zip |
Hide Request.RequestURI behind accessors in order to prevent users shooting in the foot when assigning to Request.RequestURI directly
Diffstat (limited to 'client_timing_test.go')
-rw-r--r-- | client_timing_test.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/client_timing_test.go b/client_timing_test.go index 654c3a0..c1a7273 100644 --- a/client_timing_test.go +++ b/client_timing_test.go @@ -82,7 +82,7 @@ func BenchmarkClientGetFastServer(b *testing.B) { b.RunParallel(func(pb *testing.PB) { var req Request var resp Response - req.Header.RequestURI = []byte(fmt.Sprintf("http://foobar%d.com/aaa/bbb", atomic.AddUint32(&nn, 1))) + req.Header.SetRequestURI(fmt.Sprintf("http://foobar%d.com/aaa/bbb", atomic.AddUint32(&nn, 1))) for pb.Next() { if err := c.Do(&req, &resp); err != nil { b.Fatalf("unexpected error: %s", err) @@ -135,7 +135,7 @@ func BenchmarkNetHTTPClientGetFastServer(b *testing.B) { } func fasthttpEchoHandler(ctx *RequestCtx) { - ctx.Success("text/plain", ctx.Request.Header.RequestURI) + ctx.Success("text/plain", ctx.RequestURI()) } func nethttpEchoHandler(w http.ResponseWriter, r *http.Request) { |