<commit_before>(function() {
	module.exports = function(req, res, next) {    
    if (req.method !== 'POST') return next();
    if (!req.is('application/json')) {
      return res.status(415).send('When issuing a POST to the CommitStream API, you must send a Content-Type: application/json header.');
    } else {
      return next();
    }
  };
}());<commit_msg>S-51508 throw UnsupportedMediaType custom error for missing or invalid Content-Type on POST api requests.<commit_after>(function() {
  var csError = require('./csError');

  var UnsupportedMediaType = csError.createCustomError('UnsupportedMediaType', function(message) {
    message = message || 'The Content-Type header is unspecified or invalid';
    var errors = [message];
    UnsupportedMediaType.prototype.constructor.call(this, errors, 415);
  });  

	module.exports = function(req, res, next) {    
    if (req.method !== 'POST') return next();
    if (!req.is('application/json')) {
      throw new UnsupportedMediaType('When issuing a POST to the CommitStream API, you must send a Content-Type: application/json header.');
    } else {
      return next();
    }
  };
}());
{'fraction_non_alphanumeric': 0.14136125654450263, 'fraction_numerical': 0.009598603839441536, 'mean_word_length': 3.739669421487603, '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': '3952487', 'n_tokens_mistral': 335, 'n_tokens_neox': 321, 'n_words': 98}