render
render copied to clipboard
easily manage HTTP request / response payloads of Go HTTP services
Implemented custom serializer for json: https://github.com/go-chi/render/issues/36
Adds a strict option to the DecodeJSON function to call the DisallowUnknownFields on the json decoder, returning an error if the json payload contains unknown fields.
One of the properties inside my JSON payload is a slice. In my case the `children` property. ```go type Body struct { Name string `json:"name"` Children Children `json:"children"` } func...
I want to use `github.com/goccy/go-json` as JSON serializer. I'd like to see an API to easily replace the serializer, like [echo](https://github.com/labstack/echo). This is an example about echo. https://github.com/fujiwara/isucon11-f/pull/9/files
``` go type req struct { PerPage string `query:"per_page"` APIKey string `query:"key"` } // an alternative to render.Bind to check query params and convert into req ```
This can be useful for example when outputting a URL in a JSON value, which contains a query string, where the ampersands & should remain intact.
It seems there is some special handling done for accepting status and response in a predefined order. When I try to set the JSON response before setting the HTTP status,...
In the case that a Renderer contains a slice of Renderer, the renderer mothod would not be called. A condition for a reflect.Slice was added. Tests were added to the...
Sometimes I don't need to validate anything in request. Would you consider a PR where render.Bind accepts `r *http.Request, v interface{}`, and if `v` implements Bind() method only then execute...