Duplicate WriteHeader Call/ Incorrect HTTP Response Code #1536
Unanswered
akshat-zopsmart
asked this question in
Q&A
Replies: 1 comment
-
Thanks @akshat-zopsmart for reporting it. Will check it and definitely fix it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
UseCase: Static Server, non-200 response scenario
In case of 404 scenario, the framework attempts to write the header again after it's been set by the static server.
Seeing this error in the logs:
http: superfluous response.WriteHeader call from gofr.dev/pkg/gofr/http/middleware.(*StatusResponseWriter).WriteHeader (logger.go:23)
In case the HTTP response code is not written by the static server handler, HTTP code in the response is sent as 200 if the file is found, including the not found handler (file).
Even in the application logs, the response code is shown as 200 if the not found handler (file) is present.

Only if the not found handler (file) is not present, the http code shows up 404 in the response as well as in the logs


Beta Was this translation helpful? Give feedback.
All reactions