Fix typo in twirp server status code parsing (#1361)

This commit is contained in:
Benjamin Pracht
2023-01-31 17:43:59 -08:00
committed by GitHub
parent 71eac631a1
commit 30adc6ee15
+2 -2
View File
@@ -184,14 +184,14 @@ func statusReporterResponseSent(ctx context.Context) {
var statusFamily string
if statusCode, ok := twirp.StatusCode(ctx); ok {
if status, err := strconv.Atoi(statusCode); err != nil {
if status, err := strconv.Atoi(statusCode); err == nil {
switch {
case status >= 400 && status <= 499:
statusFamily = "4xx"
case status >= 500 && status <= 599:
statusFamily = "5xx"
default:
statusFamily = strconv.Itoa(status)
statusFamily = statusCode
}
}
}