Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultHTTPErrorHandler(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, ...)
- type DialOption
- type ErrorHandlerFunc
- type HandleChainFunc
- type HeaderMatcherFunc
- type Logger
- type Marshaler
- type QueryParameterParser
- type RESTProxyServer
- type RESTProxyServerOption
- func SetQueryParameterParser(p QueryParameterParser) RESTProxyServerOption
- func WithAppendedDialOption(d DialOption) RESTProxyServerOption
- func WithErrorHandler(o ErrorHandlerFunc) RESTProxyServerOption
- func WithGRPCAddress(a string) RESTProxyServerOption
- func WithHTTPHandlers(handlers ...HandleChainFunc) RESTProxyServerOption
- func WithHandlePath(verb string, urlPath string, ...) RESTProxyServerOption
- func WithIncomingHeaderMatcher(o HeaderMatcherFunc) RESTProxyServerOption
- func WithMarshaler(mime string, m Marshaler) RESTProxyServerOption
- func WithOptionalHTTPHandlers(handlers ...HandleChainFunc) RESTProxyServerOption
- func WithOptionalRegisterHandlers(registerers ...RegisterRESTProxyServer) RESTProxyServerOption
- func WithOutgoingHeaderMatcher(o HeaderMatcherFunc) RESTProxyServerOption
- func WithPrependedDialOptions(d ...DialOption) RESTProxyServerOption
- func WithRegisterHandlers(registerers ...RegisterRESTProxyServer) RESTProxyServerOption
- type RegisterRESTProxyServer
- type ServeMux
Constants ¶
const (
MIMEWildcard = runtime.MIMEWildcard
)
Variables ¶
var ( ErrNilRegisterer = errors.New("Nil Registerer") ErrNilRegistererValue = errors.New("Nil Registerer value") )
Functions ¶
Types ¶
type DialOption ¶
type DialOption = grpc.DialOption
type ErrorHandlerFunc ¶
type ErrorHandlerFunc = runtime.ErrorHandlerFunc
type HandleChainFunc ¶
type HandleChainFunc = httpserver.HandleChainFunc
type HeaderMatcherFunc ¶
type HeaderMatcherFunc = runtime.HeaderMatcherFunc
type QueryParameterParser ¶
type QueryParameterParser = runtime.QueryParameterParser
type RESTProxyServer ¶
type RESTProxyServer struct {
// contains filtered or unexported fields
}
RESTProxyServer represents the grpc-gateway rest serve endpoint.
func New ¶
func New(log Logger, name string, port string, opts ...RESTProxyServerOption) RESTProxyServer
New creates a new RESTProxyServer that is bound to a specific GRPC Gateway API. This object complies with the standard Listener interface and can be managed by the startup.Listeners object.
func (*RESTProxyServer) Listen ¶
func (g *RESTProxyServer) Listen() error
func (*RESTProxyServer) String ¶
func (g *RESTProxyServer) String() string
type RESTProxyServerOption ¶
type RESTProxyServerOption func(*RESTProxyServer)
func SetQueryParameterParser ¶
func SetQueryParameterParser(p QueryParameterParser) RESTProxyServerOption
SetQueryParameterParser adds an intercepror that matches header values.
func WithAppendedDialOption ¶
func WithAppendedDialOption(d DialOption) RESTProxyServerOption
WithAppendedDialOption appends a grpc dial option.
func WithErrorHandler ¶
func WithErrorHandler(o ErrorHandlerFunc) RESTProxyServerOption
WithErrorHandler adds error handling in special cases - e.g on 402 or 429. Nil argument is ignored.
func WithGRPCAddress ¶
func WithGRPCAddress(a string) RESTProxyServerOption
WithGRPCAddress - overides the defaultGRPCAddress ('localhost:<port>')
func WithHTTPHandlers ¶ added in v0.10.0
func WithHTTPHandlers(handlers ...HandleChainFunc) RESTProxyServerOption
WithHTTPHandlers adds handlers on the http endpoint. A nil value will return an error on executiong Listen()
func WithHandlePath ¶
func WithHandlePath(verb string, urlPath string, f func(http.ResponseWriter, *http.Request, map[string]string)) RESTProxyServerOption
WithHandlePath add REST file path handler.
func WithIncomingHeaderMatcher ¶
func WithIncomingHeaderMatcher(o HeaderMatcherFunc) RESTProxyServerOption
WithIncomingHeaderMatcher adds an intercepror that matches header values.
func WithMarshaler ¶
func WithMarshaler(mime string, m Marshaler) RESTProxyServerOption
WithMarshaler specifies an optional marshaler.
func WithOptionalHTTPHandlers ¶ added in v0.10.0
func WithOptionalHTTPHandlers(handlers ...HandleChainFunc) RESTProxyServerOption
WithOptionalHTTPHandlers adds handlers on the http endpoint. A nil value will be ignored.
func WithOptionalRegisterHandlers ¶ added in v0.10.0
func WithOptionalRegisterHandlers(registerers ...RegisterRESTProxyServer) RESTProxyServerOption
WithOptionalRegisterHandler adds grpc-gateway handlers. A nil value will be ignored.
func WithOutgoingHeaderMatcher ¶
func WithOutgoingHeaderMatcher(o HeaderMatcherFunc) RESTProxyServerOption
WithOutgoingHeaderMatcher matches header values on output. Nil argument is ignored.
func WithPrependedDialOptions ¶ added in v0.15.3
func WithPrependedDialOptions(d ...DialOption) RESTProxyServerOption
WithPrependedDialOption prepends a grpc dial option.
func WithRegisterHandlers ¶ added in v0.10.0
func WithRegisterHandlers(registerers ...RegisterRESTProxyServer) RESTProxyServerOption
WithRegisterHandlers adds grpc-gateway handlers. A nil value will emit an error from the Listen() method.