http

package module
v0.0.0-...-ffd984a Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EndpointsHandler

func EndpointsHandler(endpoints map[string]*Endpoint) httprouter.Handle

Types

type Endpoint

type Endpoint struct {
	Method      string
	MimeType    string
	Middlewares []Middleware
	Handle      httprouter.Handle
	Path        string
}

Endpoint is the http server endpoint based on the given mime type and path.

type EndpointInitializer

type EndpointInitializer func(c *controller.Controller, db orm.DB) *Endpoint

type Middleware

type Middleware func(httprouter.Handle) httprouter.Handle

type QualityValue

type QualityValue struct {
	Value   string
	Quality float64
}

QualityValue is the structure that contains quality - value pair.

func ParseAcceptEncodingHeader

func ParseAcceptEncodingHeader(header http.Header) []QualityValue

ParseAcceptEncodingHeader parses 'Accept-Encoding' header values sorted by it's quality.

func ParseAcceptHeader

func ParseAcceptHeader(header http.Header) []QualityValue

ParseAcceptHeader parses 'Accept' header values sorted by it's quality.

type Server

type Server struct {
	// Endpoints provides the mapping between the path - mime type and given endpoint handler
	// map[path]map[method]map[mime]
	Endpoints            map[string]map[string]map[string]*Endpoint
	EndpointInitializers []EndpointInitializer
	Options              server.Options
	// contains filtered or unexported fields
}

func New

func New() *Server

func (*Server) Initialize

func (s *Server) Initialize(options *server.Options) error

func (*Server) Serve

func (s *Server) Serve() error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Jump to

Keyboard shortcuts

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