rest

package
v0.0.0-...-ffb6f1e Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error404

func Error404(w http.ResponseWriter, r *http.Request)

Error404 default response

func Error405

func Error405(w http.ResponseWriter, r *http.Request)

Error405 default response

Types

type ResponseWriter

type ResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

ResponseWriter is http.ResponseWriter that keeps status code

func (*ResponseWriter) WriteHeader

func (rw *ResponseWriter) WriteHeader(status int)

WriteHeader impl.

type Service

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

Service exposes endpoints on existing router to interact with blockchain via HTTP

func New

func New(config *config.Root, reader dao.IDAO, pool *rpcpool.Pool, saveTXChan chan<- *types.Transaction, latency mtx.Histogram, count mtx.Counter) *Service

New instance

func (*Service) OnMiddlewareTrigger

func (r *Service) OnMiddlewareTrigger(res http.ResponseWriter, req *http.Request, msg string)

OnMiddlewareTrigger will be invoked on middleware triggering

func (*Service) OnRequestContentCheck

func (r *Service) OnRequestContentCheck(_ *http.Request, contentType *string) (maxBody uint32, allow bool)

OnRequestContentCheck will be invoked on content checking (middleware). Content type is nil on GET requests (i.e. when body is not presented)

func (*Service) SetupMiddleware

func (r *Service) SetupMiddleware(router *mux.Router)

SetupMiddleware for HTTP server

func (*Service) SetupRoutes

func (r *Service) SetupRoutes(prefixes []string, router *mux.Router)

SetupRoutes for HTTP server

Directories

Path Synopsis
v1
tx

Jump to

Keyboard shortcuts

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