File tree Expand file tree Collapse file tree 2 files changed +11
-23
lines changed
Sources/GRPCCore/Call/Client
Tests/GRPCCoreTests/Call/Client Expand file tree Collapse file tree 2 files changed +11
-23
lines changed Original file line number Diff line number Diff line change @@ -363,7 +363,7 @@ extension StreamingClientResponse {
363363
364364 /// Returns the messages received from the server.
365365 ///
366- /// For rejected RPCs the `RPCAsyncSequence` throws a `RPCError``.
366+ /// For rejected RPCs (in other words, where ``accepted`` is `failure`), the `RPCAsyncSequence` throws a `RPCError``.
367367 public var messages : RPCAsyncSequence < Message , any Error > {
368368 switch self . accepted {
369369 case let . success( contents) :
@@ -385,10 +385,16 @@ extension StreamingClientResponse {
385385
386386 /// Returns the body parts (i.e. `messages` and `trailingMetadata`) returned from the server.
387387 ///
388- /// For rejected RPCs (in other words, where ``accepted`` is `failure`), this method throws an `RPCError`.
388+ /// For rejected RPCs (in other words, where ``accepted`` is `failure`), the `RPCAsyncSequence` throws a `RPCError` `.
389389 public var bodyParts : RPCAsyncSequence < Contents . BodyPart , any Error > {
390- get throws {
391- try self . accepted. get ( ) . bodyParts
390+ switch self . accepted {
391+ case let . success( contents) :
392+ return contents. bodyParts
393+
394+ case let . failure( error) :
395+ return RPCAsyncSequence . throwing ( error)
392396 }
393397 }
394398}
399+
400+ extension StreamingClientResponse . Contents . BodyPart : Equatable where Message: Equatable { }
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ final class ClientResponseTests: XCTestCase {
107107 XCTAssertEqual ( $0, error)
108108 }
109109 await XCTAssertThrowsRPCErrorAsync {
110- try response. bodyParts
110+ try await response. bodyParts. collect ( )
111111 } errorHandler: {
112112 XCTAssertEqual ( $0, error)
113113 }
@@ -210,21 +210,3 @@ final class ClientResponseTests: XCTestCase {
210210 }
211211 }
212212}
213-
214- extension StreamingClientResponse . Contents . BodyPart : Equatable where Message: Equatable {
215- static func == (
216- lhs: StreamingClientResponse . Contents . BodyPart ,
217- rhs: StreamingClientResponse . Contents . BodyPart
218- ) -> Bool {
219- switch ( lhs, rhs) {
220- case ( . message( let lhsMessage) , . message( let rhsMessage) ) :
221- return lhsMessage == rhsMessage
222-
223- case ( . trailingMetadata( let lhsMetadata) , . trailingMetadata( let rhsMetadata) ) :
224- return lhsMetadata == rhsMetadata
225-
226- default :
227- return false
228- }
229- }
230- }
You can’t perform that action at this time.
0 commit comments