internal

package
v0.0.0-...-b44df3c Latest Latest
Warning

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

Go to latest
Published: May 13, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTimeout

func GetTimeout(header http.Header, defaultTimeout time.Duration) time.Duration

GetTimeout returns the timeout from the header, if not set, returns the default timeout.

func NewRequestParser

func NewRequestParser(r *http.Request, resolver jsonpb.AnyResolver) (grpcurl.RequestParser, error)

NewRequestParser creates a new request parser from the given http.Request and resolver.

func ProcessHeaders

func ProcessHeaders(header http.Header) []string

ProcessHeaders builds the headers for the gateway from HTTP headers.

Types

type EventHandler

type EventHandler struct {
	Status *status.Status
	// contains filtered or unexported fields
}

func NewEventHandler

func NewEventHandler(
	ctx context.Context,
	r *http.Request,
	writer io.Writer,
	resolver jsonpb.AnyResolver,
	rawRespEnabled bool,
	respChain ...func(ctx context.Context, resp []byte) ([]byte, error),
) *EventHandler

func (*EventHandler) OnReceiveHeaders

func (h *EventHandler) OnReceiveHeaders(_ metadata.MD)

func (*EventHandler) OnReceiveResponse

func (h *EventHandler) OnReceiveResponse(message proto.Message)

func (*EventHandler) OnReceiveTrailers

func (h *EventHandler) OnReceiveTrailers(status *status.Status, _ metadata.MD)

func (*EventHandler) OnResolveMethod

func (h *EventHandler) OnResolveMethod(_ *desc.MethodDescriptor)

func (*EventHandler) OnSendHeaders

func (h *EventHandler) OnSendHeaders(_ metadata.MD)

type Method

type Method struct {
	HttpMethod         string
	HttpPath           string
	RpcPath            string
	I18NEnabled        bool                 // 多语言翻译
	RawRespEnabled     bool                 // 包装响应
	AuthProviderScopes auth2.Provider2Scope // 鉴权提供方和授权范围
}

func GetMethods

func GetMethods(source grpcurl.DescriptorSource) ([]Method, error)

GetMethods returns all methods of the given grpcurl.DescriptorSource.

Jump to

Keyboard shortcuts

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