<commit_before>import HTTP

extension Message {
    public var json: JSON? {
        get {
            if let existing = storage["json"] as? JSON {
                return existing
            } else if let type = headers["Content-Type"], type.contains("application/json"), type.contains("text/javascript") {
                guard case let .data(body) = body else { return nil }
                guard let json = try? JSON(bytes: body) else { return nil }
                storage["json"] = json
                return json
            } else {
                return nil
            }
        }
        set(json) {
            if let data = json {
                if let body = try? Body(data) {
                    self.body = body
                    headers["Content-Type"] = "application/json; charset=utf-8"
                }
            }
            storage["json"] = json
        }
    }
}<commit_msg>fix json to use proper OR<commit_after>import HTTP

extension Message {
    public var json: JSON? {
        get {
            if let existing = storage["json"] as? JSON {
                return existing
            } else if let type = headers["Content-Type"], type.contains(any: "application/json", "text/javascript") {
                guard case let .data(body) = body else { return nil }
                guard let json = try? JSON(bytes: body) else { return nil }
                storage["json"] = json
                return json
            } else {
                return nil
            }
        }
        set(json) {
            if let data = json {
                if let body = try? Body(data) {
                    self.body = body
                    headers["Content-Type"] = "application/json; charset=utf-8"
                }
            }
            storage["json"] = json
        }
    }
}

extension String {
    fileprivate func contains(any strings: String...) -> Bool {
        for string in strings where contains(string) {
            return true
        }
        return false
    }
}
{'fraction_non_alphanumeric': 0.09910802775024777, 'fraction_numerical': 0.0009910802775024777, 'mean_word_length': 1.2995444191343963, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '2877810', 'n_tokens_mistral': 511, 'n_tokens_neox': 486, 'n_words': 154}