Documentation ¶
Overview ¶
Package render provides JSON API responder and decoder that integrates with https://github.com/go-chi/render it also provides a `DefaultResponder` and `DefaultDecoder` for easy integration
Index ¶
- Constants
- func DecodeJSONAPI(r io.Reader, v interface{}) error
- func DefaultDecoder(r *http.Request, v interface{}) error
- func DefaultResponder(w http.ResponseWriter, r *http.Request, v interface{})
- func GetAcceptedContentType(r *http.Request) chi_render.ContentType
- func GetContentType(s string) chi_render.ContentType
- func GetRequestContentType(r *http.Request) chi_render.ContentType
- func JSONAPI(w http.ResponseWriter, r *http.Request, v interface{})
Constants ¶
View Source
const (
ContentTypeJSONAPI chi_render.ContentType = iota + 1000
)
Variables ¶
This section is empty.
Functions ¶
func DecodeJSONAPI ¶
func DefaultDecoder ¶
DefaultDecoder decodes JSON API delegates any other content type to github.con/go-chi/render
func DefaultResponder ¶
func DefaultResponder(w http.ResponseWriter, r *http.Request, v interface{})
Respond handles JSON API responses and delegates any other content type to github.com/go-chi/render automatically setting the Content-Type based on request headers
func GetAcceptedContentType ¶
func GetAcceptedContentType(r *http.Request) chi_render.ContentType
func GetContentType ¶
func GetContentType(s string) chi_render.ContentType
GetContentType extends go-ci/render to support application/vnd.api+json
func GetRequestContentType ¶
func GetRequestContentType(r *http.Request) chi_render.ContentType
GetRequestContentType is a helper function that returns ContentType based on context or request headers.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.