<commit_before>'use strict';

var Boom = require('boom');
var _ = require('lodash');
var pluginName = 'pluginJsonapi';
var utilities = require('./utilities');

// some paths sinply don't want to be jsonapi'd
var ignorePaths = [
  '/', // Lout documentation and AWS healthcheck
  '/css/{path*}' // Lout documentation
];

// certain status codes shouldn't be jsonapi'd
var ignoreStatusCodes = [
  201, // Created (used on POST)
  204 // No Content (used on DELETE)
];

const proxyableKeys = [
  'contentVersion',
  'lang'
];

var pluginJsonApi = module.exports = {};

pluginJsonApi.errorHandler = function errorHandler(request, reply, error) {
  request.log( ['error', __filename, pluginName], {
    error: error.toString(),
    data: request.data
  } );

  return reply(Boom.internal(error));
};

pluginJsonApi.alsoMakeItSo = function alsoMakeItSo(request, reply) { // eslint-disable-line consistent-return

  try {
    // If there was no error and it's not one of our ignoredPaths or ignored status codes, jsonapi it<commit_msg>proxy ticketRates up the stack<commit_after>'use strict';

var Boom = require('boom');
var _ = require('lodash');
var pluginName = 'pluginJsonapi';
var utilities = require('./utilities');

// some paths sinply don't want to be jsonapi'd
var ignorePaths = [
  '/', // Lout documentation and AWS healthcheck
  '/css/{path*}' // Lout documentation
];

// certain status codes shouldn't be jsonapi'd
var ignoreStatusCodes = [
  201, // Created (used on POST)
  204 // No Content (used on DELETE)
];

const proxyableKeys = [
  'contentVersion',
  'lang',
  'ticketRates'
];

var pluginJsonApi = module.exports = {};

pluginJsonApi.errorHandler = function errorHandler(request, reply, error) {
  request.log( ['error', __filename, pluginName], {
    error: error.toString(),
    data: request.data
  } );

  return reply(Boom.internal(error));
};

pluginJsonApi.alsoMakeItSo = function alsoMakeItSo(request, reply) { // eslint-disable-line consistent-return

  try {
    // If there was no error and it's not one of our ignoredPaths or ignored status codes, jsonapi it
{'fraction_non_alphanumeric': 0.13157894736842105, 'fraction_numerical': 0.005741626794258373, 'mean_word_length': 4.050724637681159, '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': '193816', 'n_tokens_mistral': 651, 'n_tokens_neox': 623, 'n_words': 198}