<commit_before>import Node
import HTTP

extension Message {
    /// form url encoded encoded request data
    public var formURLEncoded: Node? {
        get {
            if let existing = storage["form-urlencoded"] as? Node {
                return existing
            } else if let type = headers["Content-Type"], type.contains("application/x-www-form-urlencoded") {
                guard case let .data(body) = body else { return nil }
                let formURLEncoded = Node(formURLEncoded: body)
                storage["form-urlencoded"] = formURLEncoded
                return formURLEncoded
            } else {
                return nil
            }
        }
        
        set(data) {
            storage["form-urlencoded"] = data

            if let data = data, let bytes = try? data.formURLEncoded() {
                body = .data(bytes)
                headers["Content-Type"] = "application/x-www-form-urlencoded"
            } else if let type = headers[.contentType], type.contains("application/x-www-form-urlencoded") {
                body = .data([])
                headers.removeValue(forKey: .contentType)
            }
        }
    }
}
<commit_msg>Replace hardcoded "Content-Type" strings with enum values<commit_after>import Node
import HTTP

extension Message {
    /// form url encoded encoded request data
    public var formURLEncoded: Node? {
        get {
            if let existing = storage["form-urlencoded"] as? Node {
                return existing
            } else if let type = headers[.contentType], type.contains("application/x-www-form-urlencoded") {
                guard case let .data(body) = body else { return nil }
                let formURLEncoded = Node(formURLEncoded: body)
                storage["form-urlencoded"] = formURLEncoded
                return formURLEncoded
            } else {
                return nil
            }
        }
        
        set(data) {
            storage["form-urlencoded"] = data

            if let data = data, let bytes = try? data.formURLEncoded() {
                body = .data(bytes)
                headers[.contentType] = "application/x-www-form-urlencoded"
            } else if let type = headers[.contentType], type.contains("application/x-www-form-urlencoded") {
                body = .data([])
                headers.removeValue(forKey: .contentType)
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.1003330557868443, 'fraction_numerical': 0.0, 'mean_word_length': 1.6581858407079646, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '977454', 'n_tokens_mistral': 645, 'n_tokens_neox': 621, 'n_words': 156}