Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
altafan committed Sep 14, 2023
1 parent 7858f97 commit fb15333
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
17 changes: 14 additions & 3 deletions internal/interfaces/grpc/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,10 @@ func (s *service) newOperatorServer(
// Reverse proxy grpc-gateway.
gwmux := runtime.NewServeMux(
runtime.WithHealthzEndpoint(grpchealth.NewHealthClient(conn)),
runtime.WithMarshalerOption("application/json", &runtime.JSONPb{
runtime.WithMarshalerOption("application/json+pretty", &runtime.JSONPb{
MarshalOptions: protojson.MarshalOptions{
Indent: " ",
Multiline: true, // Optional, implied by presence of "Indent".
Multiline: true,
},
UnmarshalOptions: protojson.UnmarshalOptions{
DiscardUnknown: true,
Expand Down Expand Up @@ -595,7 +595,18 @@ func (s *service) newTradeServer(tlsConfig *tls.Config) (*http.Server, error) {
if err != nil {
return nil, err
}
gwmux := runtime.NewServeMux(runtime.WithHealthzEndpoint(grpchealth.NewHealthClient(conn)))
gwmux := runtime.NewServeMux(
runtime.WithHealthzEndpoint(grpchealth.NewHealthClient(conn)),
runtime.WithMarshalerOption("application/json+pretty", &runtime.JSONPb{
MarshalOptions: protojson.MarshalOptions{
Indent: " ",
Multiline: true,
},
UnmarshalOptions: protojson.UnmarshalOptions{
DiscardUnknown: true,
},
}),
)
if err := tdexv2.RegisterTransportServiceHandler(
ctx, gwmux, conn,
); err != nil {
Expand Down
14 changes: 13 additions & 1 deletion internal/interfaces/grpc/service_one_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"path/filepath"

grpchealth "google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/protobuf/encoding/protojson"

"github.com/improbable-eng/grpc-web/go/grpcweb"
reflectionv1 "github.com/tdex-network/reflection/api-spec/protobuf/gen/reflection/v1"
Expand Down Expand Up @@ -303,7 +304,18 @@ func (s *serviceOnePort) newServer(
return nil, err
}
// Reverse proxy grpc-gateway.
gwmux := runtime.NewServeMux(runtime.WithHealthzEndpoint(grpchealth.NewHealthClient(conn)))
gwmux := runtime.NewServeMux(
runtime.WithHealthzEndpoint(grpchealth.NewHealthClient(conn)),
runtime.WithMarshalerOption("application/json+pretty", &runtime.JSONPb{
MarshalOptions: protojson.MarshalOptions{
Indent: " ",
Multiline: true,
},
UnmarshalOptions: protojson.UnmarshalOptions{
DiscardUnknown: true,
},
}),
)

// Register wallet interface.
walletHandler := grpchandler.NewWalletHandler(
Expand Down

0 comments on commit fb15333

Please sign in to comment.