<commit_before>extension Response {
    struct BodyStream {
        let count: Int
        let callback: (BodyStreamWriter) -> ()
    }

    /// Represents an `HTTPMessage`'s body.
    ///
    ///     let body = HTTPBody(string: "Hello, world!")
    ///
    /// This can contain any data (streaming or static) and should match the message's `"Content-Type"` header.
    public struct Body: CustomStringConvertible, ExpressibleByStringLiteral {
        /// The internal HTTP body storage enum. This is an implementation detail.
        internal enum Storage {
            /// Cases
            case none
            case buffer(ByteBuffer)
            case data(Data)
            case dispatchData(DispatchData)
            case staticString(StaticString)
            case string(String)
            case stream(BodyStream)
        }
        
        /// An empty `HTTPBody`.
        public static let empty: Body = .init()
        
        public var string: String? {
            switch self.storage {
            case .buffer(var buffer): return buffer.readString(length: buffer.readableBytes)
            case .data(let data): return String(decoding: data, as: UTF8.self)
            case .dispatchData(let dispatchData): return String(decoding: dispatchData, as: UTF8.self)
            case .staticString(let staticString): return staticString.description
            case .string(let string): return string
            default: return nil
            }
        }
        
        /// The size of the HTTP body's data.
        /// `nil` is a stream.<commit_msg>Fix outdated doc comments in Response+Body.swift (#2327)<commit_after>extension Response {
    struct BodyStream {
        let count: Int
        let callback: (BodyStreamWriter) -> ()
    }

    /// Represents a `Response`'s body.
    ///
    ///     let body = Response.Body(string: "Hello, world!")
    ///
    /// This can contain any data (streaming or static) and should match the message's `"Content-Type"` header.
    public struct Body: CustomStringConvertible, ExpressibleByStringLiteral {
        /// The internal HTTP body storage enum. This is an implementation detail.
        internal enum Storage {
            /// Cases
            case none
            case buffer(ByteBuffer)
            case data(Data)
            case dispatchData(DispatchData)
            case staticString(StaticString)
            case string(String)
            case stream(BodyStream)
        }
        
        /// An empty `Response.Body`.
        public static let empty: Body = .init()
        
        public var string: String? {
            switch self.storage {
            case .buffer(var buffer): return buffer.readString(length: buffer.readableBytes)
            case .data(let data): return String(decoding: data, as: UTF8.self)
            case .dispatchData(let dispatchData): return String(decoding: dispatchData, as: UTF8.self)
            case .staticString(let staticString): return staticString.description
            case .string(let string): return string
            default: return nil
            }
        }
        
        /// The size of the HTTP body's data.
        /// `nil` is a stream.
{'fraction_non_alphanumeric': 0.09216734822271154, 'fraction_numerical': 0.0025165146272412707, 'mean_word_length': 1.8804347826086956, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '965097', 'n_tokens_mistral': 791, 'n_tokens_neox': 770, 'n_words': 263}