mirror of
https://github.com/apple/swift-nio-extras
synced 2026-11-22 04:30:42 +00:00
* 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
43 lines
1.4 KiB
Swift
43 lines
1.4 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// 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?)
|
|
}
|