File tree 2 files changed +9
-5
lines changed
Sources/OpenAPIRuntime/Interface
Tests/OpenAPIRuntimeTests/Interface
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ public final class HTTPBody: @unchecked Sendable {
142
142
public let iterationBehavior : IterationBehavior
143
143
144
144
/// Describes the total length of the body, if known.
145
- public enum Length : Sendable {
145
+ public enum Length : Sendable , Equatable {
146
146
147
147
/// Total length not known yet.
148
148
case unknown
@@ -542,10 +542,7 @@ extension HTTPBody {
542
542
@inlinable public convenience init (
543
543
_ string: some StringProtocol & Sendable
544
544
) {
545
- self . init (
546
- ByteChunk ( string) ,
547
- length: . known( string. count)
548
- )
545
+ self . init ( ByteChunk ( string) )
549
546
}
550
547
551
548
/// Creates a new body with the provided async throwing stream of strings.
Original file line number Diff line number Diff line change @@ -185,6 +185,13 @@ final class Test_Body: Test_Runtime {
185
185
XCTAssertEqual ( chunks, [ " hel " , " lo " ] . map { Array ( $0. utf8) [ ... ] } )
186
186
}
187
187
188
+ func testUTF8String( ) async throws {
189
+ XCTAssertEqual ( HTTPBody ( " abc " ) . length, . known( 3 ) )
190
+ XCTAssertEqual ( HTTPBody ( " 🤘 " ) . length, . known( 4 ) )
191
+ XCTAssertEqual ( HTTPBody ( " \u{1f603} " ) . length, . known( 4 ) )
192
+ XCTAssertEqual ( HTTPBody ( " árvíztűrő tükörfúrógép " ) . length, . known( 31 ) )
193
+ }
194
+
188
195
func testIterationBehavior_single( ) async throws {
189
196
let sequence = AsyncStream (
190
197
String . self,
You can’t perform that action at this time.
0 commit comments