Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call responseCallback with the emitted status code
There is still situation where it is possible k6 will get status code and then while it is reading the rest of the response an error will occur - timeout reading the body, bad compression, etc. All of those cases emit status code `0` and return status code `0` to the js script. But responseCallback was getting the status code directly from the response which meant that you can have an emitted metric with tag `status` and `expected_response` where the two don't make sense as the `status` is `0` but the `expected_response` was calculated based on a different value. While it might be more logical to return the status and the error in this case intact this has been the case for nearly 3 years and given the way the current js HTTP API is used this will likely just lead to very confused users which got status `200`, checked on it and then their response.body was cut halfway through.
- Loading branch information