handler

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: May 22, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TraceEnabled = false

TraceEnabled Attaches a trace field to the JSON response when enabled.

Functions

func Log

func Log(r *http.Request, rsp *Response, err error)

Types

type Handler

type Handler func(r jsonrpc.RPCRequest) Response

Handler handles API requests

func (Handler) ServeHTTP

func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RPCResponse

type RPCResponse struct {
	jsonrpc.RPCResponse
	Trace []string `json:"_trace,omitempty"`
}

type Response

type Response struct {
	Status      int
	Data        interface{}
	RedirectURL string
	Error       error
}

Response is returned by API handlers

type StatusError

type StatusError struct {
	Status int
	Err    error
}

StatusError represents an error with an associated HTTP status code.

func (StatusError) Error

func (se StatusError) Error() string

func (StatusError) Unwrap

func (se StatusError) Unwrap() error

Jump to

Keyboard shortcuts

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