Documentation ¶
Index ¶
- func AssureContentType(w http.ResponseWriter, r *http.Request, ct string) bool
- func AssureDecode(w http.ResponseWriter, r *http.Request, val interface{}) bool
- func Delete(client *http.Client, path string) error
- func Get(client *http.Client, path string) ([]byte, error)
- func JsonResponse(w http.ResponseWriter, code int, obj interface{}) error
- func Post(client *http.Client, path string, indata interface{}) ([]byte, error)
- func TestContentType(r *http.Request, ct string) (string, bool)
- type Mux
- type ResponseWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssureContentType ¶
AssureContentType returns true if the requested content-type is present in the request header and returns a JSON encoded models.Error on the http stream and false value if it is not.
func AssureDecode ¶
func AssureDecode(w http.ResponseWriter, r *http.Request, val interface{}) bool
AssureDecode returns true if can successfully decode the incoming JSON object into the provided interface. It will return false and generate a JSON encoded error message upon failure.
func Delete ¶
Delete provides a path for the Plugin to delete data from DRP over the Plugin Server RestFUL API.
func Get ¶
Get provides a path for the Plugin to get data from DRP over the Plugin Server RestFUL API.
func JsonResponse ¶
func JsonResponse(w http.ResponseWriter, code int, obj interface{}) error
JsonResponse returns a JSON object on the http writer. Setting the code and encoding the provided object.
Types ¶
type Mux ¶
Mux provides a logger wrapper http.ServeMux to provide integration with the logger system.
type ResponseWriter ¶
type ResponseWriter struct { http.ResponseWriter logger.Logger // contains filtered or unexported fields }
ResponseWriter wraps a normal http.ResponseWriter with a logger and a status value.
func (*ResponseWriter) Status ¶
func (rw *ResponseWriter) Status() int
Status returns the current status ofthe ResponseWriter.
func (*ResponseWriter) Write ¶
func (rw *ResponseWriter) Write(buf []byte) (int, error)
Write sends the specified buf after setting StatusOK if no other status has been written.
func (*ResponseWriter) WriteHeader ¶
func (rw *ResponseWriter) WriteHeader(s int)
WriteHeader takes the status code and writes the header out the http stream after recording the status.