Documentation ¶
Index ¶
- Constants
- type ContentTypeHandler
- func (handler *ContentTypeHandler) GetCodec(header http.Header) runtime.Codec
- func (handler *ContentTypeHandler) GetCodecByContentType(contentType string) runtime.Codec
- func (handler *ContentTypeHandler) GetContentType(header http.Header) string
- func (handler *ContentTypeHandler) Read(request *http.Request) []runtime.Object
- func (handler *ContentTypeHandler) ReadOne(request *http.Request) runtime.Object
- func (handler *ContentTypeHandler) WriteMany(writer http.ResponseWriter, request *http.Request, body []runtime.Object)
- func (handler *ContentTypeHandler) WriteManyWithStatus(writer http.ResponseWriter, request *http.Request, body []runtime.Object, ...)
- func (handler *ContentTypeHandler) WriteOne(writer http.ResponseWriter, request *http.Request, body runtime.Object)
- func (handler *ContentTypeHandler) WriteOneWithStatus(writer http.ResponseWriter, request *http.Request, body runtime.Object, ...)
Constants ¶
const ( // Default is the default content type Default = YAML // YAML is the yaml codec content type YAML = "application/yaml" // JSON is the json codec content type JSON = "application/json" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentTypeHandler ¶
type ContentTypeHandler struct {
// contains filtered or unexported fields
}
ContentTypeHandler is a helper for working with Content-Type header and doing read/write for http requests/response
func NewContentTypeHandler ¶
func NewContentTypeHandler(reg *runtime.Registry) *ContentTypeHandler
NewContentTypeHandler returns instance of ContentTypeHandler for provided runtime registry
func (*ContentTypeHandler) GetCodec ¶
func (handler *ContentTypeHandler) GetCodec(header http.Header) runtime.Codec
GetCodec returns runtime codec for specified http headers based on the content type
func (*ContentTypeHandler) GetCodecByContentType ¶
func (handler *ContentTypeHandler) GetCodecByContentType(contentType string) runtime.Codec
GetCodecByContentType returns runtime codec for provided content type that should be used
func (*ContentTypeHandler) GetContentType ¶
func (handler *ContentTypeHandler) GetContentType(header http.Header) string
GetContentType returns content type for provided http headers
func (*ContentTypeHandler) Read ¶
func (handler *ContentTypeHandler) Read(request *http.Request) []runtime.Object
Read runtime object(s) from the provided request using correct content type (taken from the request)
func (*ContentTypeHandler) ReadOne ¶ added in v0.1.8
func (handler *ContentTypeHandler) ReadOne(request *http.Request) runtime.Object
ReadOne runtime object from the provided request using correct content type (taken from request)
func (*ContentTypeHandler) WriteMany ¶
func (handler *ContentTypeHandler) WriteMany(writer http.ResponseWriter, request *http.Request, body []runtime.Object)
WriteMany runtime objects into the provided response writer using correct content type (taken from provided request) with default http status (200 OK)
func (*ContentTypeHandler) WriteManyWithStatus ¶
func (handler *ContentTypeHandler) WriteManyWithStatus(writer http.ResponseWriter, request *http.Request, body []runtime.Object, status int)
WriteManyWithStatus runtime objects into the provided response writer using correct content type (taken from provided request) with specified http status
func (*ContentTypeHandler) WriteOne ¶
func (handler *ContentTypeHandler) WriteOne(writer http.ResponseWriter, request *http.Request, body runtime.Object)
WriteOne runtime object into the provided response writer using correct content type (taken from provided request) with default http status (200 OK)
func (*ContentTypeHandler) WriteOneWithStatus ¶
func (handler *ContentTypeHandler) WriteOneWithStatus(writer http.ResponseWriter, request *http.Request, body runtime.Object, status int)
WriteOneWithStatus runtime object into the provided response writer using correct content type (taken from provided request) with specified http status