Documentation ¶
Index ¶
- Constants
- Variables
- func BadClientStreamPrefixError(origin string) error
- func BadServerStreamPrefixError(origin string) error
- func InvalidLineError(line string) error
- func InvalidMetadataError(text string) error
- func InvalidMethodError(line string) error
- func InvalidOriginError(text string) error
- func NewRecorder(ctx context.Context) (context.Context, func() *Dump)
- func StreamInterceptor() grpc.ServerOption
- func StreamServerInterceptor(srv any, stream grpc.ServerStream, info *grpc.StreamServerInfo, ...) error
- func UnaryClientInterceptor(ctx context.Context, method string, req, res interface{}, cc *grpc.ClientConn, ...) error
- func UnaryInterceptor() grpc.ServerOption
- func UnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- func UnknownMessageOriginError(origin string) error
- func WithUnaryInterceptor() grpc.DialOption
- type Dump
- type Message
- type Status
Constants ¶
View Source
const OriginClient = "client"
View Source
const OriginServer = "server"
Variables ¶
View Source
var ( ErrMetadataNotFound = errors.New("grpcdump: no metadata found") ErrUnknownMessageOrigin = errors.New("grpcdump: unknown message origin") ErrInvalidLine = errors.New("grpcdump: invalid line") ErrInvalidDump = errors.New("grpcdump: invalid dump") ErrInvalidMetadata = errors.New("grpcdump: invalid metadata") ErrInvalidMethod = errors.New("grpcdump: invalid method") ErrInvalidOrigin = errors.New("grpcdump: invalid origin") ErrBadClientStreamPrefix = errors.New("grpcdump: bad client stream prefix") ErrBadServerStreamPrefix = errors.New("grpcdump: bad server stream prefix") ErrMissingGRPCTestID = errors.New("grpcdump: missing grpcdump test id") )
Functions ¶
func InvalidLineError ¶
func InvalidMetadataError ¶
func InvalidMethodError ¶
func InvalidOriginError ¶
func NewRecorder ¶
NewRecorder generates a new unique id for the request, and propagates it from the client request to the server. The request/response will then be dumped from the server and set to the global map with this id. The client can then retrieve the dump using the same id. The id is automatically cleaned up after the test is done.
func StreamInterceptor ¶
func StreamInterceptor() grpc.ServerOption
func StreamServerInterceptor ¶
func StreamServerInterceptor(srv any, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error
func UnaryClientInterceptor ¶
func UnaryClientInterceptor(ctx context.Context, method string, req, res interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
func UnaryInterceptor ¶
func UnaryInterceptor() grpc.ServerOption
func UnaryServerInterceptor ¶
func UnaryServerInterceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)
func WithUnaryInterceptor ¶
func WithUnaryInterceptor() grpc.DialOption
Types ¶
type Dump ¶
type Dump struct { Addr string `json:"addr"` FullMethod string `json:"full_method"` Messages []Message `json:"messages"` Status *Status `json:"status"` Metadata metadata.MD `json:"metadata"` // The server receives metadata. Header metadata.MD `json:"header"` // The client receives header and trailer. Trailer metadata.MD `json:"trailer"` IsServerStream bool `json:"isServerStream"` IsClientStream bool `json:"isClientStream"` HeaderIdx int `json:"-"` }
https://github.com/bradleyjkemp/grpc-tools/blob/master/grpc-dump/README.md
Click to show internal directories.
Click to hide internal directories.