From 2147e1840bbff5571614d468178d070eeba2b5b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Senart?= Date: Mon, 9 Sep 2013 13:25:29 +0100 Subject: [PATCH] uint16 for HTTP Status codes --- lib/attack.go | 4 ++-- lib/reporters.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/attack.go b/lib/attack.go index dc15a0c..98d56e3 100644 --- a/lib/attack.go +++ b/lib/attack.go @@ -35,7 +35,7 @@ func Attack(targets Targets, rate uint64, duration time.Duration) []Result { // Result represents the metrics we want out of an http.Response type Result struct { - Code uint64 + Code uint16 Timestamp time.Time Timing time.Duration BytesOut uint64 @@ -73,7 +73,7 @@ func hit(req *http.Request, res chan Result) { Error: err, } if err == nil { - result.Code = uint64(r.StatusCode) + result.Code = uint16(r.StatusCode) if body, err := ioutil.ReadAll(r.Body); err != nil { if result.Code < 200 || result.Code >= 300 { result.Error = errors.New(string(body)) diff --git a/lib/reporters.go b/lib/reporters.go index e4db44d..73b7890 100644 --- a/lib/reporters.go +++ b/lib/reporters.go @@ -26,7 +26,7 @@ func ReportText(results []Result, out io.Writer) error { totalBytesOut := uint64(0) totalBytesIn := uint64(0) totalSuccess := uint64(0) - histogram := map[uint64]uint64{} + histogram := map[uint16]uint64{} errors := map[string]struct{}{} for _, res := range results {