Skip to content

Commit

Permalink
uint16 for HTTP Status codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomás Senart committed Sep 9, 2013
1 parent 15ad005 commit 2147e18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/attack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion lib/reporters.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2147e18

Please sign in to comment.