openapi-fuzzer-core
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "openapi-fuzzer-core", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "A library to generate random requests based on open-api specifications.", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
const { klona } = require("klona"); | ||
const HTTP_METHODS = ['get', 'post', 'put', 'patch', 'delete']; | ||
const HTTP_METHODS_SET = new Set(HTTP_METHODS); | ||
@@ -35,12 +36,14 @@ class Swagger { | ||
for (const method of Object.keys(path)) { | ||
this.specs.push({ | ||
name: 'PATH', | ||
request: { | ||
method, | ||
path: `${this.basePath}${route}/INVALID/PATH` | ||
}, | ||
expect: { | ||
status: [404] | ||
} | ||
}); | ||
if (HTTP_METHODS_SET.has(method)) { | ||
this.specs.push({ | ||
name: 'PATH', | ||
request: { | ||
method, | ||
path: `${this.basePath}${route}/INVALID/PATH` | ||
}, | ||
expect: { | ||
status: [404] | ||
} | ||
}); | ||
} | ||
} | ||
@@ -74,8 +77,10 @@ } | ||
for (const method of Object.keys(path)) { | ||
const info = path[method]; | ||
const parameters = info.parameters; | ||
if (parameters && parameters.length > 0) { | ||
this.fuzzPathParams(route, method, parameters); | ||
this.fuzzQueryParams(route, method, parameters); | ||
this.fuzzBodyParams(route, method, parameters); | ||
if (HTTP_METHODS_SET.has(method)) { | ||
const info = path[method]; | ||
const parameters = info.parameters; | ||
if (parameters && parameters.length > 0) { | ||
this.fuzzPathParams(route, method, parameters); | ||
this.fuzzQueryParams(route, method, parameters); | ||
this.fuzzBodyParams(route, method, parameters); | ||
} | ||
} | ||
@@ -82,0 +87,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11193
288