handle

package
v0.0.0-...-e96cef0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateMIME

func ValidateMIME(contentType string) *core.Error

Validates Content-Type header per JSON:API spec

Types

type Environment

type Environment struct {
	BaseURL    url.URL
	Graph      graph.Graph
	Parameters model.Parameters
	Stderr     *log.Logger
	Stdout     *log.Logger
}

func (*Environment) Fail

func (env *Environment) Fail(w http.ResponseWriter, r *http.Request, e *core.Error)

Fail completes an errored response.

func (*Environment) Handle404

func (env *Environment) Handle404(w http.ResponseWriter, r *http.Request)

func (*Environment) Handle405

func (env *Environment) Handle405(w http.ResponseWriter, r *http.Request)

func (*Environment) HandleCollection

func (env *Environment) HandleCollection(w http.ResponseWriter, r *http.Request)

Collection is a handler for requests corresponding to a collection of resources (of type t string), with possible methods GET, HEAD and POST.

func (*Environment) HandleRelated

func (env *Environment) HandleRelated(w http.ResponseWriter, r *http.Request)

Related is a handler for requests corresponding to a resource's related resources (primary resource of type t string and identifier i string with relationship keyed by k string), with possible methods GET and HEAD.

func (*Environment) HandleRelationship

func (env *Environment) HandleRelationship(w http.ResponseWriter, r *http.Request)

Relationship is a handler for requests corresponding to a resource's relationship (resource of type t string and identifier i string with relationship keyed by k string), with possible methods GET, HEAD, PATCH and DELETE.

func (*Environment) HandleResource

func (env *Environment) HandleResource(w http.ResponseWriter, r *http.Request)

Resource is a handler for requests corresponding to a single resource (of type t string with identifier i string), with possible methods GET, HEAD, PATCH and DELETE.

func (*Environment) Success

func (env *Environment) Success(w http.ResponseWriter, r *http.Request, response Response)

Success completes an unerrored response.

type Response

type Response struct {
	Created time.Time
	Header  http.Header
	Body    *core.Document
	Status  int
	Trailer http.Header
}

Response is the header, body and status for a response.

func NewResponse

func NewResponse() Response

NewResponse is a Response constructor.

Jump to

Keyboard shortcuts

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