aboutsummaryrefslogtreecommitdiff
path: root/server_timing_test.go
diff options
context:
space:
mode:
authorGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-11-03 14:29:03 +0200
committerGravatar Aliaksandr Valialkin <valyala@gmail.com> 2015-11-03 14:29:03 +0200
commit53e28a262fa3eafc3214f2f7ddb0a70eab99c5b3 (patch)
treecfac7bdec1e67ab5f29255e9d44e34a99b326edd /server_timing_test.go
parentDo no hold memory (read/write buffers+RequestCtx data) for idle keep-alive co... (diff)
downloadfasthttp-53e28a262fa3eafc3214f2f7ddb0a70eab99c5b3.tar.gz
fasthttp-53e28a262fa3eafc3214f2f7ddb0a70eab99c5b3.tar.bz2
fasthttp-53e28a262fa3eafc3214f2f7ddb0a70eab99c5b3.zip
Set 'Connection: close' header for the 'one request per conn' case in server benchmarks
Diffstat (limited to 'server_timing_test.go')
-rw-r--r--server_timing_test.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/server_timing_test.go b/server_timing_test.go
index 8e237f3..213cddc 100644
--- a/server_timing_test.go
+++ b/server_timing_test.go
@@ -279,6 +279,9 @@ func benchmarkServerGet(b *testing.B, clientsCount, requestsPerConn int) {
b.Fatalf("Unexpected request method: %s", ctx.Request.Header.Method)
}
ctx.Success("text/plain", fakeResponse)
+ if requestsPerConn == 1 {
+ ctx.Response.Header.ConnectionClose = true
+ }
registerServedRequest(b, ch)
},
}
@@ -293,7 +296,11 @@ func benchmarkNetHTTPServerGet(b *testing.B, clientsCount, requestsPerConn int)
if req.Method != "GET" {
b.Fatalf("Unexpected request method: %s", req.Method)
}
- w.Header().Set("Content-Type", "text/plain")
+ h := w.Header()
+ h.Set("Content-Type", "text/plain")
+ if requestsPerConn == 1 {
+ h.Set("Connection", "close")
+ }
w.Write(fakeResponse)
registerServedRequest(b, ch)
}),
@@ -314,6 +321,9 @@ func benchmarkServerPost(b *testing.B, clientsCount, requestsPerConn int) {
b.Fatalf("Unexpected body %q. Expected %q", body, fakeResponse)
}
ctx.Success("text/plain", body)
+ if requestsPerConn == 1 {
+ ctx.Response.Header.ConnectionClose = true
+ }
registerServedRequest(b, ch)
},
}
@@ -336,7 +346,11 @@ func benchmarkNetHTTPServerPost(b *testing.B, clientsCount, requestsPerConn int)
if !bytes.Equal(body, fakeResponse) {
b.Fatalf("Unexpected body %q. Expected %q", body, fakeResponse)
}
- w.Header().Set("Content-Type", "text/plain")
+ h := w.Header()
+ h.Set("Content-Type", "text/plain")
+ if requestsPerConn == 1 {
+ h.Set("Connection", "close")
+ }
w.Write(body)
registerServedRequest(b, ch)
}),