Documentation ¶
Index ¶
- Constants
- func BadRequest(cause error) error
- func Forbidden(cause error) error
- func GetSummary(rev *Revision, repo *chain.Repository, bft bft.Committer) (sum *chain.BlockSummary, err error)
- func HTTPError(cause error, status int) error
- func ParseJSON(r io.Reader, v interface{}) error
- func WrapHandlerFunc(f HandlerFunc) http.HandlerFunc
- func WriteJSON(w http.ResponseWriter, obj interface{}) error
- type HandlerFunc
- type M
- type Revision
Constants ¶
View Source
const (
JSONContentType = "application/json; charset=utf-8"
)
content types
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
BadRequest convenience method to create http bad request error.
func GetSummary ¶
func GetSummary(rev *Revision, repo *chain.Repository, bft bft.Committer) (sum *chain.BlockSummary, err error)
GetSummary returns the block summary for the given revision, revision required to be a deterministic block other than "next".
func WrapHandlerFunc ¶
func WrapHandlerFunc(f HandlerFunc) http.HandlerFunc
WrapHandlerFunc convert HandlerFunc to http.HandlerFunc.
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, obj interface{}) error
WriteJSON response an object in JSON encoding.
Types ¶
type HandlerFunc ¶
type HandlerFunc func(http.ResponseWriter, *http.Request) error
HandlerFunc like http.HandlerFunc, bu it returns an error. If the returned error is httpError type, httpError.status will be responded, otherwise http.StatusInternalServerError responded.
type Revision ¶
type Revision struct {
// contains filtered or unexported fields
}
func ParseRevision ¶
ParseRevision parses a query parameter into a block number or block ID.
Click to show internal directories.
Click to hide internal directories.