http

package
v0.0.0-...-fae07df Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2016 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON

func JSON(w http.ResponseWriter, status int, obj interface{})

JSON helper to write json to Response writer

Types

type Error

type Error struct {
	Status  int    `json:"-"`
	Message string `json:"message"`
	Detail  string `json:"detail"`
}

Error ...

func ErrForbidden

func ErrForbidden(detail string) *Error

func ErrInternalServer

func ErrInternalServer(detail string) *Error

func ErrInvalidRequest

func ErrInvalidRequest(detail string) *Error

func ErrNotAllowed

func ErrNotAllowed(detail string) *Error

func ErrNotFound

func ErrNotFound(detail string) *Error

type HttpHandler

type HttpHandler func(http.ResponseWriter, *http.Request) *Error

HttpHandler wrapper that expects a error in return

func (HttpHandler) ServeHTTP

func (fn HttpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

HttpHandler's ServeHTTP method

type MultipartForm

type MultipartForm struct {
	Data *multipart.FileHeader `json:"data"`
}

func (*MultipartForm) FieldMap

func (f *MultipartForm) FieldMap(req *http.Request) binding.FieldMap

func (*MultipartForm) Upload

func (f *MultipartForm) Upload(srv *service.Storage) (*metadata.Metadata, error)

type Server

type Server struct {
	StorageService *service.Storage
	Config         *confer.Config
	Signer         *gosigner.Signer
	DB             *bolt.DB

	Stats bolt.Stats
	// contains filtered or unexported fields
}

func NewServer

func NewServer(c *confer.Config) (*Server, error)

func (*Server) CheckNonceFunc

func (s *Server) CheckNonceFunc(n string) error

function for the signer to check nonces and store them so a nonce can't be used twice, @TODO: clean the database once in a while

func (*Server) HTTPHandler

func (s *Server) HTTPHandler() http.Handler

func (*Server) ImageOptionsFromRequest

func (s *Server) ImageOptionsFromRequest(r *http.Request) (*engine.ImageOptions, error)

func (*Server) MeasureStats

func (s *Server) MeasureStats()

Jump to

Keyboard shortcuts

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