mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
* Allow adding a sequence of headers to HTTPHeaders Motivation: When combining two collections of headers, adding each pair one-by-one using add(name:value:) can cause multiple unnecessary reallocations of the underlying array. Modifications: Provide two additional add methods to HTTPHeaders: one to add a sequence of name/value pairs and another to add the headers from another HTTPHeaders, both of which use `append(contentsOf:)` on the underlying array to avoid additional reallocations. Result: Fewer reallocations when adding multiple headers. * Fix incorrect documentation, make add<S: Sequence>(contentsOf:) @inlineable * Reserve capacity and add sequentially instead of using append(contentsOf:) * Add tests and missing @usableFromInline