<commit_before>import Pretender from 'pretender';
import userConfig from '../pretender/config';
import store from 'ember-pretenderify/store';
import frontController from 'ember-pretenderify/controllers/front';
import ENV from '../config/environment';

var defaults = function() {
  var _this = this;

  this.data = this.data || {};
  this.timing = 400;

  this.store = store;
  this.store.loadData(this.data || {});

  this.frontController = frontController;

  this.prepareBody = function(body) {
    return body ? JSON.stringify(body) : '{"error": "not found"}';
  };

  this.unhandledRequest = function(verb, path) {
    console.error("Your Ember app tried to " + verb + " '" + path + "', but there was no Pretender route defined to handle this request.");
  };

  this.stub = function(verb, path, handler, code) {
    var store = this.store;
    var _this = this;
    var timing = ENV.environment === 'test' ? 0 : this.timing;
    var namespace = this.namespace || '';
    path = path[0] === '/' ? path.slice(1) : path;

    this[verb].call(this, namespace + '/' + path, function(request) {
      console.log('Successful request: ' + verb.toUpperCase() + ' ' + request.url);

      return _this.frontController.handle(verb, handler, store, request, code);
    }, timing);

  }.bind(this);
};

export default {<commit_msg>default HTTP return codes<commit_after>import Pretender from 'pretender';
import userConfig from '../pretender/config';
import store from 'ember-pretenderify/store';
import frontController from 'ember-pretenderify/controllers/front';
import ENV from '../config/environment';

var defaults = function() {
  var _this = this;

  this.data = this.data || {};
  this.timing = 400;

  this.store = store;
  this.store.loadData(this.data || {});

  this.frontController = frontController;

  this.prepareBody = function(body) {
    return body ? JSON.stringify(body) : '{"error": "not found"}';
  };

  this.unhandledRequest = function(verb, path) {
    console.error("Your Ember app tried to " + verb + " '" + path + "', but there was no Pretender route defined to handle this request.");
  };

  this.getDefaultCode = function(verb) {
    var code = 200;
    switch (verb) {
      case 'put':
        code = 204;
        break;
      case 'post':
        code = 201;
        break;
      case 'delete':
        code = 204;
        break;
      default:
        code = 200;
        break;
    }

    return code;
  };

  this.stub = function(verb, path, handler, code) {
    var store = this.store;
    var _this = this;
    var timing = ENV.environment === 'test' ? 0 : this.timing;
    var namespace = this.namespace || '';
    var code = code ? code : this.getDefaultCode(verb);
    path = path[0] === '/' ? path.slice(1) : path;

    this[verb].call(this, namespace + '/' + path, function(request) {
      console.log('Successful request: ' + verb.toUpperCase() + ' ' + request.url);

      return _this.frontController.handle(verb, handler, store, request, code);
    }, timing);

  }.bind(this);
};

export default {
{'fraction_non_alphanumeric': 0.15154503616042078, 'fraction_numerical': 0.008875739644970414, 'mean_word_length': 3.1345108695652173, 'pattern_counts': {'":': 2, '<': 3, '<?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': '5427325', 'n_tokens_mistral': 970, 'n_tokens_neox': 924, 'n_words': 248}