grpc / grpc/grpc-node

Allow Customization for Composition of Client and Call Level Interceptors

Open
#2,428 2 comments 0 reactions 0 assignees View on GitHub
feature request package: @grpc/grpc-js
Dominant language
TypeScript
Stars
4.8k
Forks
716
Avg merge
2d 3h
Merged PRs (30d)
10

Description

### Is your feature request related to a problem? Please describe.
Service usage customization both for Client and Call level

### Describe the solution you'd like
From [here](https://github.com/grpc/grpc-node/blob/master/packages/grpc-js/src/client-interceptors.ts#L531) it looks like it is possible to use interceptors only either on a Client level or a specific Call one.

So what is the logic behind this?

What if there're different request customizations for both of them. E.g. authorization specific setup on a Client level and specific Call related settings on its own?

Or maybe at least it would be good (even the best) to make it possible to manage the way interceptors are composed for a final execution (override / chaining)

### Describe alternatives you've considered
Maybe is it possible for a current implementation to customize the behavior with any workaround, having access from Call interceptor to Client ones. e.g. to compose something like

```ts
const withClientInterceptors = () => {
// extract and use somehow Client interceptors
}

myClient.specificCall(
request,
{
interceptors: [withClientInterceptors, callSpecificInterseptor]
},
callback,
)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.