mirror of
https://github.com/apple/swift-nio-extras
synced 2026-11-25 04:47:50 +00:00
Motivation: Previously, when using the response compressor, doing a flush() right before finishing the response data would cause the final compression chunk to be omitted. Some strict decompressors (such as gzip or the zlib functionality exported in nodejs) would refuse to decompress the incomplete response. With this change, the generated compressed response is properly finalized. Modifications: In HTTPResponseCompressor.swift, a channel write is now also generated if no body data is added, but a flush is required. Result: The response is now correct for this edge case, enabling gzip, nodejs, et al., to decompress it without errors.