Skip to content

Instantly share code, notes, and snippets.

View adam-fowler's full-sized avatar

Adam Fowler adam-fowler

View GitHub Profile
@adam-fowler
adam-fowler / server.swift
Last active January 12, 2025 11:55
NIOAsyncChannel server
import NIOCore
import NIOHTTP1
import NIOPosix
/// Sendable server response that doesn't use ``IOData``
public typealias SendableHTTPServerResponsePart = HTTPPart<HTTPResponseHead, ByteBuffer>
/// Channel to convert HTTPServerResponsePart to the Sendable type HBHTTPServerResponsePart
final class HTTPSendableResponseChannelHandler: ChannelOutboundHandler, RemovableChannelHandler {
typealias OutboundIn = SendableHTTPServerResponsePart