<commit_before>var mime = require('mime');

module.exports = function(config) {
  'use strict';

  var cfg = config || {};
  var prefix = cfg.prefix || 'original';
  var ext = cfg.extensionName || 'requestExtension';

  var accepts = function() {
    var re = mime.lookup(this[ext]);

    for (var i = 0; i < arguments.length; i++) {
      var t = arguments[i];
      if (this[ext] == t || re == t)
        return t;
    }
    return this[prefix + 'Accepts'].call(this, arguments);
  };

  var middleware = function*(next) {
    var m = this.path.match(/(.*)\.(.*)$/);

    if (m) {
      this[prefix + 'Accepts'] = this.accepts;
      this.accepts = accepts;
      this[ext] = m[2].toLowerCase();<commit_msg>Call upstream accept method with the correct convention.<commit_after>var mime = require('mime');

module.exports = function(config) {
  'use strict';

  var cfg = config || {};
  var prefix = cfg.prefix || 'original';
  var ext = cfg.extensionName || 'requestExtension';

  var accepts = function() {
    var re = mime.lookup(this[ext]);

    for (var i = 0; i < arguments.length; i++) {
      var t = arguments[i];
      if (this[ext] == t || re == t)
        return t;
    }
    return this[prefix + 'Accepts'].apply(this, arguments);
  };

  var middleware = function*(next) {
    var m = this.path.match(/(.*)\.(.*)$/);

    if (m) {
      this[prefix + 'Accepts'] = this.accepts;
      this.accepts = accepts;
      this[ext] = m[2].toLowerCase();
{'fraction_non_alphanumeric': 0.1826265389876881, 'fraction_numerical': 0.0027359781121751026, 'mean_word_length': 2.7803617571059434, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '3029453', 'n_tokens_mistral': 493, 'n_tokens_neox': 479, 'n_words': 126}