MCPcopy
hub / github.com/connectrpc/connect-go / WrapUnary

Method WrapUnary

client_ext_test.go:854–866  ·  view source on GitHub ↗
(next connect.UnaryFunc)

Source from the content-addressed store, hash-verified

852}
853
854func (a *assertSchemaInterceptor) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc {
855 return func(ctx context.Context, req connect.AnyRequest) (connect.AnyResponse, error) {
856 if !assert.NotNil(a.tb, req.Spec().Schema) {
857 return next(ctx, req)
858 }
859 methodDesc, ok := req.Spec().Schema.(protoreflect.MethodDescriptor)
860 if assert.True(a.tb, ok) {
861 procedure := fmt.Sprintf("/%s/%s", methodDesc.Parent().FullName(), methodDesc.Name())
862 assert.Equal(a.tb, procedure, req.Spec().Procedure)
863 }
864 return next(ctx, req)
865 }
866}
867
868func (a *assertSchemaInterceptor) WrapStreamingClient(next connect.StreamingClientFunc) connect.StreamingClientFunc {
869 return func(ctx context.Context, spec connect.Spec) connect.StreamingClientConn {

Callers

nothing calls this directly

Calls 5

NotNilFunction · 0.92
TrueFunction · 0.92
EqualFunction · 0.92
SpecMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected