engine

package
v2.0.0-beta.1.0...-e4ab053 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address      string
	TLSCertfile  string
	TLSKeyfile   string
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
}

Config defines engine configuration.

type Engine

type Engine interface {
	SetHandler(Handler)
	SetLogger(*log.Logger)
	Start()
}

Engine defines the interface for HTTP server.

type Handler

type Handler interface {
	ServeHTTP(Request, Response)
}

Handler defines an interface to server HTTP requests via `ServeHTTP(Request, Response)` function.

type HandlerFunc

type HandlerFunc func(Request, Response)

HandlerFunc is an adapter to allow the use of `func(Request, Response)` as HTTP handlers.

func (HandlerFunc) ServeHTTP

func (h HandlerFunc) ServeHTTP(req Request, res Response)

ServeHTTP serves HTTP request.

type Header interface {
	Add(string, string)
	Del(string)
	Set(string, string)
	Get(string) string
}

Header defines the interface for HTTP header.

type Request

type Request interface {
	// TLS returns true if connection is TLS otherwise false.
	TLS() bool

	Scheme() string
	Host() string
	URI() string
	URL() URL
	Header() Header
	// Proto() string
	// ProtoMajor() int
	// ProtoMinor() int
	UserAgent() string
	RemoteAddress() string
	Method() string
	SetMethod(string)
	Body() io.ReadCloser
	FormValue(string) string
	FormFile(string) (*multipart.FileHeader, error)
	MultipartForm() (*multipart.Form, error)
}

Request defines the interface for HTTP request.

type Response

type Response interface {
	Header() Header
	WriteHeader(int)
	Write(b []byte) (int, error)
	Status() int
	Size() int64
	Committed() bool
	Writer() io.Writer
	SetWriter(io.Writer)
}

Response defines the interface for HTTP response.

type URL

type URL interface {
	Path() string
	SetPath(string)
	QueryValue(string) string
}

URL defines the interface for HTTP request url.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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