Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GzipMiddleware ¶
GzipMiddleware compresses HTTP responses and decompresses requests.
It handles both request decompression (Content-Encoding: gzip) and response compression (Accept-Encoding: gzip).
Requests without compression are handled normally for backward compatibility.
Types ¶
type BackendRegistry ¶
type BackendRegistry interface {
GetBackend(service string) (proxy.Backend, func(), bool)
HasBackend(service string) bool
}
BackendRegistry is the subset of backend lookup API required by the HTTP proxy.
GetBackend leases the returned backend: the caller must call the release function exactly once when it is done using the backend, or the connection may be kept open past the point it should have closed. HasBackend performs the same lookup without leasing, so a handler can reject an unregistered service before it pays for reading the request body.
type TransparentWebGRPCProxy ¶
type TransparentWebGRPCProxy struct {
// contains filtered or unexported fields
}
TransparentWebGRPCProxy is an HTTP handler that translates HTTP requests with binary protobuf payloads to gRPC calls.
func NewHTTPHandler ¶
func NewHTTPHandler(registry BackendRegistry, options ...Option) *TransparentWebGRPCProxy
NewHTTPHandler creates a new HTTPHandler.
func (*TransparentWebGRPCProxy) ServeHTTP ¶
func (m *TransparentWebGRPCProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles HTTP requests.