http

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2017 License: Apache-2.0 Imports: 25 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS added in v0.6.1

func CORSFunc added in v0.6.1

func CORSFunc(w http.ResponseWriter, req *http.Request, params httprouter.Params)

func GetQueryShape

func GetQueryShape(q string, ses query.HTTP) ([]byte, error)

func LogRequest

func LogRequest(handler ResponseHandler) httprouter.Handle

func MarkdownWithCSS

func MarkdownWithCSS(input []byte, title string) []byte

func ParseJSONToQuadList

func ParseJSONToQuadList(jsonBody []byte) (out []quad.Quad, _ error)

func Serve

func Serve(handle *graph.Handle, cfg *config.Config)

func SetupRoutes

func SetupRoutes(handle *graph.Handle, cfg *config.Config)

func WrapErrResult

func WrapErrResult(err error) ([]byte, error)

func WrapResult

func WrapResult(result interface{}) ([]byte, error)

Types

type API

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

func (*API) APIv1

func (api *API) APIv1(r *httprouter.Router)

func (*API) APIv2 added in v0.6.1

func (api *API) APIv2(r *httprouter.Router)

func (*API) GetHandleForRequest

func (api *API) GetHandleForRequest(r *http.Request) (*graph.Handle, error)

func (*API) RWOnly added in v0.6.1

func (api *API) RWOnly(handler httprouter.Handle) httprouter.Handle

func (*API) ServeV1Delete

func (api *API) ServeV1Delete(w http.ResponseWriter, r *http.Request, params httprouter.Params) int

func (*API) ServeV1Query

func (api *API) ServeV1Query(w http.ResponseWriter, r *http.Request, params httprouter.Params) int

TODO(barakmich): Turn this into proper middleware.

func (*API) ServeV1Shape

func (api *API) ServeV1Shape(w http.ResponseWriter, r *http.Request, params httprouter.Params) int

func (*API) ServeV1Write

func (api *API) ServeV1Write(w http.ResponseWriter, r *http.Request, _ httprouter.Params) int

func (*API) ServeV1WriteNQuad

func (api *API) ServeV1WriteNQuad(w http.ResponseWriter, r *http.Request, params httprouter.Params) int

func (*API) ServeV2Delete added in v0.6.1

func (api *API) ServeV2Delete(w http.ResponseWriter, r *http.Request, _ httprouter.Params) int

func (*API) ServeV2Formats added in v0.6.1

func (api *API) ServeV2Formats(w http.ResponseWriter, r *http.Request, _ httprouter.Params) int

func (*API) ServeV2Read added in v0.6.1

func (api *API) ServeV2Read(w http.ResponseWriter, r *http.Request, _ httprouter.Params) int

func (*API) ServeV2Write added in v0.6.1

func (api *API) ServeV2Write(w http.ResponseWriter, r *http.Request, _ httprouter.Params) int

type AcceptSpec added in v0.6.1

type AcceptSpec struct {
	Value string
	Q     float64
}

AcceptSpec describes an Accept* header.

func ParseAccept added in v0.6.1

func ParseAccept(header http.Header, key string) (specs []AcceptSpec)

ParseAccept parses Accept* headers.

type DocRequestHandler

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

func (*DocRequestHandler) ServeHTTP

func (h *DocRequestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request, params httprouter.Params)

type ErrorQueryWrapper

type ErrorQueryWrapper struct {
	Error string `json:"error"`
}

type ResponseHandler

type ResponseHandler func(http.ResponseWriter, *http.Request, httprouter.Params) int

type SuccessQueryWrapper

type SuccessQueryWrapper struct {
	Result interface{} `json:"result"`
}

type TemplateRequestHandler

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

func (*TemplateRequestHandler) ServeHTTP

Jump to

Keyboard shortcuts

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