<commit_before>var restify = require('restify');
var Croonga = require('./croonga');

exports.createServer = function (config) {
  var croonga = new Croonga(config.baseDir);

  var handlers = {
    CreateDomain: function(req, res, next) {
      var domainName = req.query.DomainName;
      if (!domainName || domainName === '') {
        return next(new restify.InvalidArgumentError("Invalid DomainName"));
      }
      croonga.createDomain(domainName);
      res.send(domainName);
    }
  };

  function respond(req, res, next) {
    var action = req.query.Action || '';
    var handler = handlers[action];
    if (!handler) {
      return next(new restify.InvalidArgumentError("Action '" + action + "' is not supported"));
    }
    return handler(req, res, next);
  }

  var server = restify.createServer({
    name: 'croonga'
  });
  server.use(restify.queryParser());
  server.get('/', respond);

  return server;
};<commit_msg>Prevent from responding methods on prototype<commit_after>var restify = require('restify');
var Croonga = require('./croonga');

exports.createServer = function (config) {
  var croonga = new Croonga(config.baseDir);

  var handlers = Object.create(null);

  handlers.CreateDomain = function(req, res, next) {
    var domainName = req.query.DomainName;
    if (!domainName || domainName === '') {
      return next(new restify.InvalidArgumentError("Invalid DomainName"));
    }
    croonga.createDomain(domainName);
    res.send(domainName);
  };

  function respond(req, res, next) {
    var action = req.query.Action || '';
    var handler = handlers[action];
    if (!handler) {
      return next(new restify.InvalidArgumentError("Action '" + action + "' is not supported"));
    }
    return handler(req, res, next);
  }

  var server = restify.createServer({
    name: 'croonga'
  });
  server.use(restify.queryParser());
  server.get('/', respond);

  return server;
};
{'fraction_non_alphanumeric': 0.14824515453116816, 'fraction_numerical': 0.0, 'mean_word_length': 3.602409638554217, 'pattern_counts': {'":': 0, '<': 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': '1491322', 'n_tokens_mistral': 589, 'n_tokens_neox': 573, 'n_words': 134}