forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rest.go
33 lines (25 loc) · 845 Bytes
/
rest.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package rest
import (
"net/http"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/rest"
"github.com/gorilla/mux"
)
// REST query and parameter values
const (
RestParamEvidenceHash = "evidence-hash"
MethodGet = "GET"
)
// EvidenceRESTHandler defines a REST service evidence handler implemented in
// another module. The sub-route is mounted on the evidence REST handler.
type EvidenceRESTHandler struct {
SubRoute string
Handler func(http.ResponseWriter, *http.Request)
}
// RegisterRoutes registers all Evidence submission handlers for the evidence module's
// REST service handler.
func RegisterRoutes(clientCtx client.Context, rtr *mux.Router, handlers []EvidenceRESTHandler) {
r := rest.WithHTTPDeprecationHeaders(rtr)
registerQueryRoutes(clientCtx, r)
registerTxRoutes(clientCtx, r, handlers)
}