Browse Source

Add generation of client interceptors (#1272)

Nikita 4 years ago
parent
commit
665e6d193c
1 changed files with 12 additions and 3 deletions
  1. 12 3
      Sources/protoc-gen-grpc-swift/Generator-Client+AsyncAwait.swift

+ 12 - 3
Sources/protoc-gen-grpc-swift/Generator-Client+AsyncAwait.swift

@@ -108,7 +108,10 @@ extension Generator {
             self.withIndentation("return self.make\(callTypeWithoutPrefix)", braces: .round) {
             self.withIndentation("return self.make\(callTypeWithoutPrefix)", braces: .round) {
               self.println("path: \(self.methodPath),")
               self.println("path: \(self.methodPath),")
               self.println("request: request,")
               self.println("request: request,")
-              self.println("callOptions: callOptions ?? self.defaultCallOptions")
+              self.println("callOptions: callOptions ?? self.defaultCallOptions,")
+              self.println(
+                "interceptors: self.interceptors?.\(self.methodInterceptorFactoryName)() ?? []"
+              )
             }
             }
           }
           }
 
 
@@ -121,7 +124,10 @@ extension Generator {
           ) {
           ) {
             self.withIndentation("return self.make\(callTypeWithoutPrefix)", braces: .round) {
             self.withIndentation("return self.make\(callTypeWithoutPrefix)", braces: .round) {
               self.println("path: \(self.methodPath),")
               self.println("path: \(self.methodPath),")
-              self.println("callOptions: callOptions ?? self.defaultCallOptions")
+              self.println("callOptions: callOptions ?? self.defaultCallOptions,")
+              self.println(
+                "interceptors: self.interceptors?.\(self.methodInterceptorFactoryName)() ?? []"
+              )
             }
             }
           }
           }
         }
         }
@@ -181,7 +187,10 @@ extension Generator {
             ) {
             ) {
               self.println("path: \(self.methodPath),")
               self.println("path: \(self.methodPath),")
               self.println("\(requestParamName): \(requestParamName),")
               self.println("\(requestParamName): \(requestParamName),")
-              self.println("callOptions: callOptions ?? self.defaultCallOptions")
+              self.println("callOptions: callOptions ?? self.defaultCallOptions,")
+              self.println(
+                "interceptors: self.interceptors?.\(self.methodInterceptorFactoryName)() ?? []"
+              )
             }
             }
           }
           }
         }
         }