<commit_before><?php

class ZaphpaCORS extends Zaphpa_Middleware {

  private $domain;
  
  function __construct($domain = '*') {
    $this->domain = $domain;
  }
  
  function preroute(&$req, &$res) { 
    header("Access-Control-Allow-Origin: {$this->domain}", true);
  } 
}<commit_msg>Update plugins/ZaphpaCORS.class.php<commit_after><?php

class ZaphpaCORS extends Zaphpa_Middleware {

  private $domain;
  
  function __construct($domain = '*') {
    $this->domain = $domain;
  }
  
  function preroute(&$req, &$res) { 
    header("Access-Control-Allow-Origin: {$this->domain}", true);
    
    if (strcasecmp(Zaphpa_Router::getRequestMethod(), "options") == 0) {
        header("Access-Control-Allow-Methods: GET, POST", true);
        header("Access-Control-Allow-Headers: origin, x-http-method-override, accept", true);
    }
    
  } 
}
{'fraction_non_alphanumeric': 0.16587677725118483, 'fraction_numerical': 0.001184834123222749, 'mean_word_length': 3.6944444444444446, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6932376', 'n_tokens_mistral': 292, 'n_tokens_neox': 282, 'n_words': 48}