Documentation
¶
Overview ¶
Package gcprest serves the REST/JSON surface of a gRPC-only Google Cloud emulator by transcoding HTTP requests, driven by the google.api.http annotations on the service protos, into in-process calls on the registered gRPC implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPStatus ¶
HTTPStatus maps a gRPC code to the HTTP status Google APIs use for it.
func Serve ¶
Serve serves srv's gRPC API and its REST/JSON transcoding on l, telling them apart by the HTTP/2 connection preface. REST calls reach the handlers through an in-memory pipe, never the network. Stopping srv closes l and the REST server with it.
Types ¶
type Extra ¶
type Extra struct {
Match func(path string) bool
MatchRequest func(r *http.Request) bool
Handler http.Handler
}
Extra routes requests to Handler instead of the REST transcoder. MatchRequest, when set, sees the whole request (Host included) and takes precedence; otherwise Match decides on the URL path alone.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds the REST routes derived from a gRPC server's registered services.