mirror of
https://github.com/apple/swift-nio-extras
synced 2026-11-29 05:24:21 +00:00
Add HTTP types adapter for SwiftNIO (#202)
* Add HTTP types adapter for SwiftNIO * swiftformat * Guard on Swift 5.8 * Review comments * Update swift-http-types to 0.1.1 * Update swift-http-types to 1.0.0 * Review feedback * Review feedback * Bump minimum Swift version to 5.7.1 * Allow Host in any order
This commit is contained in:
1 parent
6c3819cf2a
commit
798c962495
12 files changed
+1489
-5
No files matched your search
@@ -0,0 +1,42 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This source file is part of the SwiftNIO open source project
|
||||
//
|
||||
// Copyright (c) 2023 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
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
import HTTPTypes
|
||||
import NIOCore
|
||||
|
||||
/// The parts of a complete HTTP request.
|
||||
///
|
||||
/// An HTTP request message is made up of a request encoded by `.head`, zero or
|
||||
/// more body parts, and optionally some trailers.
|
||||
///
|
||||
/// To indicate that a complete HTTP message has been sent or received, we use
|
||||
/// `.end`, which may also contain any trailers that make up the message.
|
||||
public enum HTTPRequestPart: Sendable, Hashable {
|
||||
case head(HTTPRequest)
|
||||
case body(ByteBuffer)
|
||||
case end(HTTPFields?)
|
||||
}
|
||||
|
||||
/// The parts of a complete HTTP response.
|
||||
///
|
||||
/// An HTTP response message is made up of one or more response headers encoded
|
||||
/// by `.head`, zero or more body parts, and optionally some trailers.
|
||||
///
|
||||
/// To indicate that a complete HTTP message has been sent or received, we use
|
||||
/// `.end`, which may also contain any trailers that make up the message.
|
||||
public enum HTTPResponsePart: Sendable, Hashable {
|
||||
case head(HTTPResponse)
|
||||
case body(ByteBuffer)
|
||||
case end(HTTPFields?)
|
||||
}
|
||||
Reference in new issue
Block a user