<commit_before>'use strict'

var parameterize = require('./parameters.js')
var url = require('url')
var response = require('./response.js')
require('string.prototype.startswith')

function middleware (swaggerDef, options, next) {
  var parsedUrl = url.parse(this._url)
  var path = decodeURI(parsedUrl.pathname)

  // handle basePath if set and different from /
  if (swaggerDef.basePath && swaggerDef.basePath !== '/') {
    if (!path.startsWith(swaggerDef.basePath)) {
      throw new Error('Swagger spec does not define path: ' + this._url)
    }

    // remove basePath before searching path into swagger paths
    path = path.replace(swaggerDef.basePath, '')
    path = path === '' ? '/' : path
  }

  if (!swaggerDef.paths[path]) {
    throw new Error('Swagger spec does not define path: ' + this._url)
  }
  if (!options.method) {
    throw new Error('No request method provided(get, post, delete, etc)')
  }
  var method = options.method.toLowerCase()
  var pathSpec = swaggerDef.paths[path][method]

  // inspect the base path for any params that should be used by all sibling operations
  var pathSpecShared = swaggerDef.paths[path]['parameters']
  if (pathSpecShared != undefined) {
     pathSpec.parameters = (pathSpec == undefined) ? pathSpecShared : pathSpec.parameters.concat(pathSpecShared)<commit_msg>Adds extra path to check<commit_after>'use strict'

var parameterize = require('./parameters.js')
var url = require('url')
var response = require('./response.js')
require('string.prototype.startswith')

function middleware (swaggerDef, options, next) {
  var parsedUrl = url.parse(this._url)
  var path = decodeURI(parsedUrl.pathname)

  // handle basePath if set and different from /
  if (swaggerDef.basePath && swaggerDef.basePath !== '/') {
    if (!path.startsWith(swaggerDef.basePath)) {
      throw new Error('Swagger spec does not define path: ' + this._url)
    }

    // remove basePath before searching path into swagger paths
    path = path.replace(swaggerDef.basePath, '')
    path = path === '' ? '/' : path
  }

  if (!swaggerDef.paths[path]) {
    throw new Error('Swagger spec does not define path: ' + this._url)
  }
  if (!options.method) {
    throw new Error('No request method provided(get, post, delete, etc)')
  }
  var method = options.method.toLowerCase()
  var pathSpec = swaggerDef.paths[path][method]

  // inspect the base path for any params that should be used by all sibling operations
  var pathSpecShared = swaggerDef.paths[path]['parameters']
  if (pathSpecShared != undefined) {
     pathSpec.parameters = (pathSpec.parameters == undefined) ? pathSpecShared : pathSpec.parameters.concat(pathSpecShared)
{'fraction_non_alphanumeric': 0.12678705793829947, 'fraction_numerical': 0.0, 'mean_word_length': 4.016981132075472, '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': '1154271', 'n_tokens_mistral': 782, 'n_tokens_neox': 778, 'n_words': 225}