shabbyrobe / grpc-stubs

gRPC typing stubs for Python
MIT License
36 stars 21 forks source link

Fix ClientInterceptor stubs #54

Open RobinMcCorkell opened 2 days ago

RobinMcCorkell commented 2 days ago

Description of change

Fix the generic-ness of the non-aio and aio ClientInterceptors: previously an interceptor was generic over (TRequest, TResponse) meaning that an instantiated interceptor can only handle one particular RPC. This is clearly wrong, as an interceptor (which is attached to the channel) should be able to handle all RPCs. This means that an interceptor must be generic-less and the intercept methods should be generic over all (TRequest, TResponse) instead.

See the new test cases for an example of how interceptors are meant to work.

A few other fixes and tweaks too:

Minimum Reproducible Example

See the added test cases.

Checklist: