<commit_before>import Nest


public struct Request : RequestType, CustomStringConvertible, CustomDebugStringConvertible {
  public var method:String
  public var path:String
  public var headers:[Header]
  public var body:String?

  public init(method:String, path:String, headers:[Header]? = nil, body:String? = nil) {
    self.method = method
    self.path = path
    self.headers = headers ?? []
    self.body = body
  }

  public var description:String {
    return "\(method) \(path)"
  }

  public var debugDescription:String {
    let request = ["\(method) \(path)"] + headers.map { "\($0) \($1)" }
    return request.joinWithSeparator("\n")
  }
}


extension RequestType {
  public subscript(header: String) -> String? {
    get {
      return headers.filter { $0.0 == header }.first?.1
    }
  }

  /// Returns the Host header
  public var host:String? {
    return self["Host"]
  }

  /// Returns the Content-Type header
  public var contentType:String? {
    return self["Content-Type"]
  }

  /// Returns the Content-Length header
  public var contentLength:Int? {
    if let contentLength = self["Content-Length"] {
      return Int(contentLength)
    }

    return nil
  }

  /// Returns the Accept header
  public var accept:String? {
    return self["Accept"]
  }

  /// Returns the Authorization header
  public var authorization:String? {
    return self["Authorization"]
  }<commit_msg>Compare headers in same case, headers are not guaranteed to be in proper case<commit_after>import Nest


public struct Request : RequestType, CustomStringConvertible, CustomDebugStringConvertible {
  public var method:String
  public var path:String
  public var headers:[Header]
  public var body:String?

  public init(method:String, path:String, headers:[Header]? = nil, body:String? = nil) {
    self.method = method
    self.path = path
    self.headers = headers ?? []
    self.body = body
  }

  public var description:String {
    return "\(method) \(path)"
  }

  public var debugDescription:String {
    let request = ["\(method) \(path)"] + headers.map { "\($0) \($1)" }
    return request.joinWithSeparator("\n")
  }
}


extension RequestType {
  public subscript(header: String) -> String? {
    get {
      return headers.filter { $0.0.lowercaseString == header.lowercaseString }.first?.1
    }
  }

  /// Returns the Host header
  public var host:String? {
    return self["Host"]
  }

  /// Returns the Content-Type header
  public var contentType:String? {
    return self["Content-Type"]
  }

  /// Returns the Content-Length header
  public var contentLength:Int? {
    if let contentLength = self["Content-Length"] {
      return Int(contentLength)
    }

    return nil
  }

  /// Returns the Accept header
  public var accept:String? {
    return self["Accept"]
  }

  /// Returns the Authorization header
  public var authorization:String? {
    return self["Authorization"]
  }
{'fraction_non_alphanumeric': 0.12078458362009635, 'fraction_numerical': 0.0034411562284927736, 'mean_word_length': 3.152857142857143, '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': '3354085', 'n_tokens_mistral': 863, 'n_tokens_neox': 833, 'n_words': 245}