<commit_before>// jshint strict:true, node:true, camelcase:true, curly:true, maxcomplexity:15, newcap:true
"use strict";

var pillars = require('../index');
var crier = require('crier').addGroup('pillars').addGroup('plugins').addGroup('CORS');
var Plugin = require('../lib/Plugin');

var plugin = module.exports = new Plugin({
  id: 'CORS'
}, function (gw, done) {
  if (gw.origin) {
    var cors = gw.routing.check('cors', pillars.config.cors);
    if (cors === true || (Array.isArray(cors) && cors.indexOf(gw.origin) >= 0)) {
      gw.cors.origin = gw.origin;
      gw.cors.credentials = true;
      gw.cors.methods = gw.pillar.method.concat(['OPTIONS', 'HEAD']);
    }
  }
  done();
});<commit_msg>Correct fill of gw.cors.methods<commit_after>// jshint strict:true, node:true, camelcase:true, curly:true, maxcomplexity:15, newcap:true
"use strict";

var pillars = require('../index');
var crier = require('crier').addGroup('pillars').addGroup('plugins').addGroup('CORS');
var Plugin = require('../lib/Plugin');

var plugin = module.exports = new Plugin({
  id: 'CORS'
}, function (gw, done) {
  if (gw.origin) {
    var cors = gw.routing.check('cors', pillars.config.cors);
    if (cors === true || (Array.isArray(cors) && cors.indexOf(gw.origin) >= 0)) {
      gw.cors.origin = gw.origin;
      gw.cors.credentials = true;
      gw.cors.methods = gw.routing.inheritance.method.concat(['OPTIONS', 'HEAD']);
    }
  }
  done();
});
{'fraction_non_alphanumeric': 0.2002791346824843, 'fraction_numerical': 0.00418702023726448, 'mean_word_length': 4.031578947368421, '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': '2078036', 'n_tokens_mistral': 538, 'n_tokens_neox': 524, 'n_words': 101}