matteofigus / api-benchmark

A node.js tool to benchmark APIs
MIT License
311 stars 35 forks source link

Request errors breaks response tab #20

Closed dmyers closed 9 years ago

dmyers commented 9 years ago

When the request handler class detects the response status code not matching the expected one it returns the error code and message, but doesn't include the response so the tab displays undefined.

https://github.com/matteofigus/api-benchmark/blob/master/lib/request-handler.js

I'm wondering what the best way to fix this is. I also noticed if you pass in a string it doesn't match since it is doing strict comparison to of them and expects ints. We could do parseInt() if we want to support passing in a string.

screen shot 2015-06-02 at 4 52 44 pm screen shot 2015-06-02 at 4 52 51 pm

matteofigus commented 9 years ago

Ok, I would keep strict int comparison there and I would use the sanitiser to ensure any input is an int: https://github.com/matteofigus/api-benchmark/blob/master/lib/sanitise.js

In regards of the sampled undefined response, totally, I would like this fixed :+1: good spot