Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix endpoint status logging #247

Closed
Jumpy-Squirrel opened this issue Dec 12, 2024 · 0 comments · Fixed by #248
Closed

fix endpoint status logging #247

Jumpy-Squirrel opened this issue Dec 12, 2024 · 0 comments · Fixed by #248
Assignees

Comments

@Jumpy-Squirrel
Copy link
Contributor

Jumpy-Squirrel commented Dec 12, 2024

We have some endpoints that do not correctly log success status 200, instead they log 0.

Only affects logging.

Cause: This happends if the endpoint implementation neither calls WriteHeader nor writes a response body. http.Server still sends a default status 200, but the request wrapper used to record the status for logging doesn't know this, and logs 0.

Solution: explicitly call w.WriteHeader(http.StatusOK) at the end of the endpoint handler. It's clearer anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant