You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey @Xib1uvXi! I'm here to assist you with any Kratos issues you're facing. I can help you with bug fixes, answer questions, and guide you on becoming a contributor. Let's tackle this together!
The issue with response.WriteHeader being called more than once in the Go-Kratos framework, specifically from the http.DefaultErrorEncoder in codec.go at line 116, occurs because WriteHeader is called both when an error occurs during marshaling and again after setting the content type and before writing the response body.
To resolve this issue, ensure that WriteHeader is only called once. You can modify the DefaultErrorEncoder function to set a flag or return early if WriteHeader has already been called due to an error. Here's a possible solution:
This solution assumes that w.Header().Written() is a method that checks if WriteHeader has already been called. If such a method does not exist, you may need to implement a custom mechanism to track whether WriteHeader has been called [1].
What happened:
Environment:
kratos -v
):go version
): go version go1.23.2cat /etc/os-release
): linux / arm64The text was updated successfully, but these errors were encountered: