diff --git a/lib/index.js b/lib/index.js index abf77f7..a8d58fb 100644 --- a/lib/index.js +++ b/lib/index.js @@ -396,7 +396,7 @@ function calculateDomains (protocol, hosts, port) { */ function scrapeURL (url) { // Avoid parse empty url request - if (url === '' || url.raw === '') { + if (url === undefined || url === '' || url.raw === '') { return { valid: false } } const rawUrl = (typeof url === 'string' || url instanceof String) ? url : url.raw diff --git a/package-lock.json b/package-lock.json index e89aca4..8461bca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "postman-to-openapi", - "version": "2.7.0", + "version": "2.7.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "postman-to-openapi", - "version": "2.7.0", + "version": "2.7.1", "license": "MIT", "dependencies": { "commander": "^8.3.0", diff --git a/package.json b/package.json index 1fbb33c..5baf8e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "postman-to-openapi", - "version": "2.7.0", + "version": "2.7.1", "description": "Convert postman collection to OpenAPI spec", "main": "lib/index.js", "types": "types/index.d.ts", diff --git a/test/resources/input/v2/PostmantoOpenAPI.json b/test/resources/input/v2/PostmantoOpenAPI.json index 4f84ab2..ef26385 100644 --- a/test/resources/input/v2/PostmantoOpenAPI.json +++ b/test/resources/input/v2/PostmantoOpenAPI.json @@ -61,6 +61,14 @@ "description": "Just an example of text raw body" }, "response": [] + }, + { + "name": "No url request", + "request": { + "method": "GET", + "header": [] + }, + "response": [] } ], "event": [ diff --git a/test/resources/input/v21/PostmantoOpenAPI.json b/test/resources/input/v21/PostmantoOpenAPI.json index 822a7c5..2951956 100644 --- a/test/resources/input/v21/PostmantoOpenAPI.json +++ b/test/resources/input/v21/PostmantoOpenAPI.json @@ -91,6 +91,14 @@ "description": "Just an example of text raw body" }, "response": [] + }, + { + "name": "No url request", + "request": { + "method": "GET", + "header": [] + }, + "response": [] } ], "event": [