apple / swift-nio-http2

HTTP/2 support for SwiftNIO
https://swiftpackageindex.com/apple/swift-nio-http2/main/documentation/niohttp2
Apache License 2.0
462 stars 82 forks source link

Fix test for `HPACKHeader.removeAll(keepingCapacity:)` on Android #395

Closed finagolfin closed 1 year ago

finagolfin commented 1 year ago

Motivation:

Get this test passing on Android

Modifications:

Change the capacity to whatever it originally was, rather than a hard-coded value.

Result:

Resolves #394 and the test now passes

I could not reproduce on Android when assigning to a String array like this, implying this overcapacity is specific to this HPACK header array:

var headerArray : [String] = []

func assign(_ headers: [(String, String)] = []) {
   print(headers.count)
   print(headers.capacity)
   headerArray = headers.map { "headerKey : \($0.0), headerValue: \($0.1)" }
   print(headerArray.count)
   print(headerArray.capacity)
}
        let original = [
            ("foo", "bar"),
            ("bar", "foo"),
            ("foo", "baz"),
            ("foo", "bar,baz"),
            ("foo", " bar ,baz ,,"),
            ("bar", "foo")
        ]
assign(original)
Lukasa commented 1 year ago

@swift-server-bot test this please