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

EncodeJSONResponse - http: superfluous response.WriteHeader call #13

Open
aeharvlee opened this issue May 22, 2022 · 1 comment
Open
Labels
bug Something isn't working

Comments

@aeharvlee
Copy link
Contributor

Describe the bug
When request to rosetta-etheruem using roestta-cli check:data, it often returns

2022/05/22 06:02:13 http: superfluous response.WriteHeader call from github.com/klaytn/rosetta-sdk-go-klaytn/server.EncodeJSONResponse (routers.go:86)

Related source code:

// EncodeJSONResponse uses the json encoder to write an interface to the http response with an
// optional status code
func EncodeJSONResponse(i interface{}, status int, w http.ResponseWriter) {
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.WriteHeader(status)
if err := json.NewEncoder(w).Encode(i); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}

I found Go Forum posting which deals with this problem and now I'm trying to solve this problem.

@aeharvlee aeharvlee added the bug Something isn't working label May 22, 2022
@aeharvlee
Copy link
Contributor Author

I also created coinbase/mesh-sdk-go#407 to share this problem with Coinbase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant