#1196·fasthttp

(h *ResponseHeader) StatusCode() int Leads to misunderstanding

Author: waclawthedevCreated Jan 16, 2022Updated Aug 28, 2026
Labelshelp wanted

header.go

// StatusCode returns response status code.
func (h *ResponseHeader) StatusCode() int {
	if h.statusCode == 0 {
		return StatusOK
	}
	return h.statusCode
}

leads to misunderstanding, because while I debug my code, I expect StatusCode() will return the the value with same sense as h.statusCode but it returns HTTP response code. I propose to rename this method to HTTPStatusCode or assign to h.statusCode another name.