Http_req_failed shows 1 fail on a 200 ok response

http_req_failed shows 1 fail on a 200 ok response.

using k6 version: 0.31.1 and the sample scripts in k6 repo.

k6 run --http-debug samples/http_get.js

 http_req_failed................: 0.00% ✓ 0 ✗ 1

The response code of the http call is 200.

Yeah… :man_facepalming: this is a bit of a double-negative we didn’t realize would be a UX problem until shortly before the release :sweat_smile: You have 1 not-failed request, i.e. 1 successful request…

We plan to fix it for k6 v0.32.0, follow Replace text summary generation with JS code · Issue #1806 · grafana/k6 · GitHub and Change http_req_failed line in output summary · Issue #24 · grafana/jslib.k6.io · GitHub for updates.

You can fix it yourself a bit earlier if you write a custom handleSummary() handler that uses a tweaked version of textSummary(). This is essentially what this issue is about.

1 Like