func channelRead()

in Sources/NIOTSHTTPServer/main.swift [26:37]


    func channelRead(context: ChannelHandlerContext, data: NIOAny) {
        let part = self.unwrapInboundIn(data)

        guard case .head = part else {
            return
        }

        let responseHeaders = HTTPHeaders([("server", "nio-transport-services"), ("content-length", "0")])
        let responseHead = HTTPResponseHead(version: .init(major: 1, minor: 1), status: .ok, headers: responseHeaders)
        context.write(self.wrapOutboundOut(.head(responseHead)), promise: nil)
        context.writeAndFlush(self.wrapOutboundOut(.end(nil)), promise: nil)
    }