transport

package
v0.0.0-...-5d4656b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2018 License: MPL-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONErrorResponse

func JSONErrorResponse(w http.ResponseWriter, err error)

JSONErrorResponse is a convenience function to transform errors into JSON HTTP responses

func JSONOKResponse

func JSONOKResponse(w http.ResponseWriter, message string)

JSONOKResponse is a convenience function to transform success messages into JSON HTTP responses

func JSONResponse

func JSONResponse(w http.ResponseWriter, payload interface{})

JSONResponse is a convenience function to transform data into JSON HTTP responses

Types

type HTTPTransport

type HTTPTransport struct {
	// contains filtered or unexported fields
}

HTTPTransport implements an HTTP server around a NetLog.

func NewHTTPTransport

func NewHTTPTransport(nl *netlog.NetLog) *HTTPTransport

NewHTTPTransport transport sets up an HTTP interface around a NetLog.

func (*HTTPTransport) ServeHTTP

func (ht *HTTPTransport) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface around a NetLog.

type IDMsg

type IDMsg struct {
	ID string `json:"id"`
}

IDMsg is the standard response when returning an ID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL