<commit_before>/*
  This set of UT validate request/response against public resources.
*/

var request = require('supertest');

var host = 'http://127.0.0.1:8082';

var app = request(host);

var public_resources = [
  {
    'url': '/',
    'type': 'text/html',
    'status': 200
  },
  {
    'url': '/index.html',
    'type': 'text/html',
    'status': 200
  },
  {
    'url': '/public',
    'type': 'application/json',
    'status': 200
  },
  {
    'url': '/unexistent',
    'type': 'text/html; charset=UTF-8',
    'status': 404
  }
];

var validate_mandatory_headers = function(headers) {
  var mandatory_headers = {
    'X-XSS-Protection': '1; mode=block',
    'X-Robots-Tag': 'noindex',
    'X-Content-Type-Options': 'nosniff',
    'Expires': '-1',
    'Server': 'globaleaks',
    'Pragma': 'no-cache',
    'Cache-control': 'no-cache, no-store, must-revalidate',
    'Content-Security-Policy': 'referrer no-referrer',
    'X-Frame-Options': 'sameorigin'
  };

  for (var key in mandatory_headers) {
    if (headers[key.toLowerCase()] !== mandatory_headers[key]) {
      throw key + ' != ' + mandatory_headers[key];
    }
  }
};

public_resources.forEach(function(req){<commit_msg>Update API tests due to recent data defaults updates<commit_after>/*
  This set of UT validate request/response against public resources.
*/

var request = require('supertest');

var host = 'http://127.0.0.1:8082';

var app = request(host);

var public_resources = [
  {
    'url': '/',
    'type': 'text/html',
    'status': 200
  },
  {
    'url': '/index.html',
    'type': 'text/html',
    'status': 200
  },
  {
    'url': '/public',
    'type': 'application/json',
    'status': 200
  },
  {
    'url': '/unexistent',
    'type': 'text/html; charset=UTF-8',
    'status': 404
  }
];

var validate_mandatory_headers = function(headers) {
  var mandatory_headers = {
    'X-XSS-Protection': '1; mode=block',
    'X-Content-Type-Options': 'nosniff',
    'Expires': '-1',
    'Server': 'globaleaks',
    'Pragma': 'no-cache',
    'Cache-control': 'no-cache, no-store, must-revalidate',
    'Content-Security-Policy': 'referrer no-referrer',
    'X-Frame-Options': 'sameorigin'
  };

  for (var key in mandatory_headers) {
    if (headers[key.toLowerCase()] !== mandatory_headers[key]) {
      throw key + ' != ' + mandatory_headers[key];
    }
  }
};

public_resources.forEach(function(req){
{'fraction_non_alphanumeric': 0.1934398654331371, 'fraction_numerical': 0.021026072329688814, 'mean_word_length': 3.1663747810858145, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '7523345', 'n_tokens_mistral': 877, 'n_tokens_neox': 854, 'n_words': 173}