Skip to content

Commit ffe5bd4

Browse files
committed
fixup incorrect assumption
1 parent 3270253 commit ffe5bd4

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

Sources/GRPC/GRPCClientStateMachine.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -521,14 +521,14 @@ extension GRPCClientStateMachine.State {
521521
"user-agent": "grpc-swift-nio", // TODO: Add a more specific user-agent.
522522
]
523523

524-
// Message level encoding.
524+
// Request encoding.
525525
if let outbound = compression.outbound {
526526
headers.add(name: GRPCHeaderName.encoding, value: outbound.name)
527+
}
527528

528-
// Only send 'accept-encoding' if inbound and outbound are enabled.
529-
if !compression.inbound.isEmpty {
530-
headers.add(name: GRPCHeaderName.acceptEncoding, value: compression.acceptEncodingHeader)
531-
}
529+
// Response encoding.
530+
if !compression.inbound.isEmpty {
531+
headers.add(name: GRPCHeaderName.acceptEncoding, value: compression.acceptEncodingHeader)
532532
}
533533

534534
// Add the timeout header, if a timeout was specified.

Tests/GRPCTests/GRPCClientStateMachineTests.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,9 +707,7 @@ extension GRPCClientStateMachineTests {
707707
encoding: .init(forRequests: nil, acceptableForResponses: [.identity, .gzip])
708708
)).assertSuccess { headers in
709709
XCTAssertFalse(headers.contains(name: "grpc-encoding"))
710-
// If we don't set request encoding then we shouldn't set the accept-encoding header. (The
711-
// compression asymmetry can be achieved by setting the request compression to '.identity'.)
712-
XCTAssertFalse(headers.contains(name: "grpc-accept-encoding"))
710+
XCTAssertTrue(headers.contains(name: "grpc-accept-encoding"))
713711
}
714712
}
715713

0 commit comments

Comments
 (0)