grpcgateway

package
v0.0.0-...-8e59d5e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultServeMuxOption = []runtime.ServeMuxOption{
	runtime.WithErrorHandler(DefaultErrorHandler),
	runtime.WithRoutingErrorHandler(DefaultRoutingErrorHandler),
	runtime.WithIncomingHeaderMatcher(DefaultHeaderWarp),

	runtime.WithMarshalerOption("application/json", &runtime.JSONPb{
		MarshalOptions: protojson.MarshalOptions{
			EmitUnpopulated: true,
			UseProtoNames:   true,
		},
		UnmarshalOptions: protojson.UnmarshalOptions{
			DiscardUnknown: false,
		},
	}),

	runtime.WithMarshalerOption("application/jsonpb", &runtime.JSONPb{
		MarshalOptions: protojson.MarshalOptions{
			EmitUnpopulated: true,
			UseProtoNames:   true,
		},
		UnmarshalOptions: protojson.UnmarshalOptions{
			DiscardUnknown: false,
		},
	}),

	runtime.WithMarshalerOption(runtime.MIMEWildcard, &runtime.JSONPb{
		MarshalOptions: protojson.MarshalOptions{
			EmitUnpopulated: true,
			UseProtoNames:   true,
		},
		UnmarshalOptions: protojson.UnmarshalOptions{
			DiscardUnknown: false,
		},
	}),
}

Functions

func AddToHeaderAllowList

func AddToHeaderAllowList(allowList ...string)

func DefaultErrorHandler

func DefaultErrorHandler(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, r *http.Request, err error)

func DefaultHTTPServer

func DefaultHTTPServer(handler http.Handler) *http.Server

func DefaultHeaderWarp

func DefaultHeaderWarp(key string) (string, bool)

func DefaultRoutingErrorHandler

func DefaultRoutingErrorHandler(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, r *http.Request, httpStatus int)

func GRPCGatewayListener

func GRPCGatewayListener(mux cmux.CMux) net.Listener

func GRPCServerListener

func GRPCServerListener(mux cmux.CMux) net.Listener

func HTTPServer

func HTTPServer(handler http.Handler, warps ...func(http.Handler) http.Handler) *http.Server

func NewMixedPortServeMux

func NewMixedPortServeMux(ctx context.Context, endpoint string, registers ...Register) (*runtime.ServeMux, error)

func WithLogger

func WithLogger(handler http.Handler) http.Handler

func WithOpenTelemetry

func WithOpenTelemetry(handler http.Handler) http.Handler

func WithResponseWriter

func WithResponseWriter(handler http.Handler) http.Handler

Types

type Register

type Register func(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

type ResponseWriter

type ResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

func (ResponseWriter) Write

func (w ResponseWriter) Write(body []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL