<commit_before>part of start;

class Response {
  HttpResponse _response;

  Response(this._response);

  header(String name, [value]) {
    if (value == null) {
      return _response.headers[name];
    }
    _response.headers.set(name, value);
    return this;
  }

  Response get(String name) => header(name);

  Response set(String name, String value) => header(name, value);

  Response type(String contentType) => set('Content-Type', contentType);

  Response cache(String cacheType, [Map<String,String> options]) {
    if(options == null) {
      options = {};
    }
    StringBuffer value = new StringBuffer(cacheType);
    options.forEach((key, val) {
      value.write(', ${key}=${val}');
    });
    return set('Cache-Control', value.toString());
  }

  Response status(int code) {
    _response.statusCode = code;
    return this;
  }

  Response cookie(String name, String val, [Map options]) {
    var cookie = new Cookie(name, val),
        cookieMirror = reflect(cookie);

    options.forEach((option, value) {
      cookieMirror.setField(new Symbol(option), value);
    });

    return header('Set-Cookie', cookie.toString());
  }<commit_msg>closes #50<commit_after>part of start;

class Response {
  HttpResponse _response;

  Response(this._response);

  header(String name, [value]) {
    if (value == null) {
      return _response.headers[name];
    }
    _response.headers.set(name, value);
    return this;
  }

  Response get(String name) => header(name);

  Response set(String name, String value) => header(name, value);

  Response type(String contentType) => set('Content-Type', contentType);

  Response cache(String cacheType, [Map<String,String> options]) {
    if(options == null) {
      options = {};
    }
    StringBuffer value = new StringBuffer(cacheType);
    options.forEach((key, val) {
      value.write(', ${key}=${val}');
    });
    return set('Cache-Control', value.toString());
  }

  Response status(int code) {
    _response.statusCode = code;
    return this;
  }

  Response cookie(String name, String val, [Map options]) {
    var cookie = new Cookie(name, val),
        cookieMirror = reflect(cookie);

    if (options != null) {
      options.forEach((option, value) {
        cookieMirror.setField(new Symbol(option), value);
      });
    }

    return header('Set-Cookie', cookie.toString());
  }
{'fraction_non_alphanumeric': 0.1465590484282073, 'fraction_numerical': 0.0008496176720475786, 'mean_word_length': 3.3773234200743496, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '7110831', 'n_tokens_mistral': 719, 'n_tokens_neox': 690, 'n_words': 172}