mirror of
https://github.com/apple/swift-nio-extras.git
synced 2025-05-14 00:42:41 +08:00
### Motivation: There will be times when a client wishes to send larger requests with gzipped bodies to save on network traffic. This PR adds a `NIOHTTPRequestDecompressor` which can be added to the server's channel pipeline so those requests are automatically inflated. ### Modifications: - Added a `CNIOExtrasZlib_voidPtr_to_BytefPtr` C method. - Added a `NIOHTTPRequestDecompressor` type. - Added a `HTTPResponseDecompressorTest` test case. ### Result: Now you don't have to manually check the `Content-Encoding` header and decompress the body on each incoming request.
37 lines
1.1 KiB
Swift
37 lines
1.1 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// HTTPRequestDecompressorTest+XCTest.swift
|
|
//
|
|
import XCTest
|
|
|
|
///
|
|
/// NOTE: This file was generated by generate_linux_tests.rb
|
|
///
|
|
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
|
|
///
|
|
|
|
extension HTTPRequestDecompressorTest {
|
|
|
|
static var allTests : [(String, (HTTPRequestDecompressorTest) -> () throws -> Void)] {
|
|
return [
|
|
("testDecompressionNoLimit", testDecompressionNoLimit),
|
|
("testDecompressionLimitRatio", testDecompressionLimitRatio),
|
|
("testDecompressionLimitSize", testDecompressionLimitSize),
|
|
("testDecompression", testDecompression),
|
|
]
|
|
}
|
|
}
|
|
|