fix handler strip path
This commit is contained in:
parent
b44b6a331c
commit
f8279d9653
@ -2,6 +2,7 @@ package grpc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
@ -29,8 +30,15 @@ func (a *appGRPCServer) registerServiceGatewayHandlers(ctx context.Context, serv
|
|||||||
|
|
||||||
clientConn := a.GetClientConn(ctx)
|
clientConn := a.GetClientConn(ctx)
|
||||||
|
|
||||||
|
var errs error
|
||||||
for _, registerGW := range service.GwRegistrationFuncs {
|
for _, registerGW := range service.GwRegistrationFuncs {
|
||||||
registerGW(ctx, a.gatewayMux, clientConn)
|
errs = errors.Join(errs, registerGW(ctx, a.gatewayMux, clientConn))
|
||||||
|
a.logger.Debug().Any("fwo", a.gatewayMux.GetForwardResponseOptions()).
|
||||||
|
Msg("calling gateway registration func")
|
||||||
|
}
|
||||||
|
|
||||||
|
if errs != nil {
|
||||||
|
panic(errs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type GRPCOpts struct {
|
type GRPCOpts struct {
|
||||||
*config.GRPCConfig
|
*config.GRPCConfig // Settings configurable by env or yaml
|
||||||
*AppGRPC
|
*AppGRPC // Settings provided in code
|
||||||
}
|
}
|
||||||
|
|
||||||
type AppGRPC struct {
|
type AppGRPC struct {
|
||||||
|
@ -69,7 +69,7 @@ func prepHTTPServer(opts *opts.AppHTTP) *http.Server {
|
|||||||
// if enabled, the path prefix is stripped before
|
// if enabled, the path prefix is stripped before
|
||||||
// requests are sent to the handler
|
// requests are sent to the handler
|
||||||
if h.StripPrefix {
|
if h.StripPrefix {
|
||||||
h.Handler = http.StripPrefix(h.Prefix, h.Handler)
|
h.Handler = http.StripPrefix(h.Prefix[:len(h.Prefix)-1], h.Handler)
|
||||||
}
|
}
|
||||||
mux.Handle(h.Prefix, h.Handler)
|
mux.Handle(h.Prefix, h.Handler)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user