Skip to content

Fix status code label in prometheus counter to not be zero when response header isn't explicitly set

Sometimes for non GET endpoints, we handle the payload and explicitly write status code into the response write if only there is a HTTP error. After error handling, the route handler just returns without explicitly setting 200 or writing anything to response body. In this case then the middleware counts it as a 0 status code. This fix checks the status code on statusResponseWriter and sets it to 200, if nothing was explicitly set before.

Merge request reports