go-chi / go-chi/render

Any concern render.JSON() can leak internal errors to outside?

Open
#57 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
339
Forks
66
PR merge metrics
No merged PRs in 30d

Description

Hi, the JSON rendering code seems to expose direct encoding errors to outside
https://github.com/go-chi/render/blob/master/responder.go#L98

```go
if err := enc.Encode(v); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
```

would it be better to add another function argument to `render.JSON()` or something, rather than exposing library error messages?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.