-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
Describe the bug
I am trying to create a custom interceptor that propogates few extra header information. I implemented the code as per the example. But i keep getting the error:

My code implementation is somewhere around this:
import GRPCCore
struct AuthInterceptor: ClientInterceptor {
func intercept<Input: Sendable, Output: Sendable>(r
request: StreamingClientRequest<Input>,
context: ClientContext,
next: @Sendable (
_ request: StreamingClientRequest<Input>,
_ context: ClientContext
) async throws -> StreamingClientResponse<Output>
) async throws -> StreamingClientResponse<Output> {
var request = request
request.metadata.replaceOrAddString("stoelkf", forKey: "authorization")
return try await next(request, context)
}
}the grpc project version i am using is: 2.1.0, but i also tried with the latest commit in this repo but it didnt help
To reproduce
My Xcode version is 26.0.1 (17A400).
swift-driver version: 1.127.14.1 Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
Target: arm64-apple-macosx26.0
Steps to reproduce the bug you've found:
- Create a new iOS project
- Import grpc-swift-2
- Add the code
import GRPCCore
struct LoggingClientInterceptor: ClientInterceptor {
func intercept<Input: Sendable, Output: Sendable>(r
request: StreamingClientRequest<Input>,
context: ClientContext,
next: @Sendable (
_ request: StreamingClientRequest<Input>,
_ context: ClientContext
) async throws -> StreamingClientResponse<Output>
) async throws -> StreamingClientResponse<Output> {
print("Invoking method '\(context.descriptor)'")
let response = try await next(request, context)
switch response.accepted {
case .success:
print("Server accepted RPC for processing")
case .failure(let error):
print("Server rejected RPC with error '\(error)'")
}
return response
}
}Expected behaviour
- ideally i should have no trouble implementing the protocol and compiler should not throw any error
Additional information
I am new to swift, but i am well versed with grpc. I might be missing something obvious too.
Metadata
Metadata
Assignees
Labels
No labels
