provision: Index | Files

package mux

import ""


Package Files


func AssureContentType Uses

func AssureContentType(w http.ResponseWriter, r *http.Request, ct string) bool

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 Uses

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 Uses

func Delete(client *http.Client, path string) error

Delete provides a path for the Plugin to delete data from DRP over the Plugin Server RestFUL API.

func Get Uses

func Get(client *http.Client, path string) ([]byte, error)

Get provides a path for the Plugin to get data from DRP over the Plugin Server RestFUL API.

func JsonResponse Uses

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.

func Post Uses

func Post(client *http.Client, path string, indata interface{}) ([]byte, error)

Post provides a path for the Plugin to send messages to DRP over the Plugin Server RestFUL API.

func TestContentType Uses

func TestContentType(r *http.Request, ct string) (string, bool)

TestContentType tests to ensure that requested content type is in the header.

type Mux Uses

type Mux struct {

Mux provides a logger wrapper http.ServeMux to provide integration with the logger system.

func New Uses

func New(bl logger.Logger) *Mux

New creates a new Mux structure with the provided logger.

func (*Mux) Handle Uses

func (m *Mux) Handle(path string, h http.HandlerFunc)

Handle registers a handler at the path on the provided Mux.

type ResponseWriter Uses

type ResponseWriter struct {
    // contains filtered or unexported fields

ResponseWriter wraps a normal http.ResponseWriter with a logger and a status value.

func (*ResponseWriter) Status Uses

func (rw *ResponseWriter) Status() int

Status returns the current status ofthe ResponseWriter.

func (*ResponseWriter) Write Uses

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 Uses

func (rw *ResponseWriter) WriteHeader(s int)

WriteHeader takes the status code and writes the header out the http stream after recording the status.

Package mux imports 11 packages (graph) and is imported by 2 packages. Updated 2019-09-08. Refresh now. Tools for package owners.