Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check the url can be undefined Close #224 #227

Merged
merged 1 commit into from
Sep 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
8 changes: 8 additions & 0 deletions test/resources/input/v2/PostmantoOpenAPI.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@
"description": "Just an example of text raw body"
},
"response": []
},
{
"name": "No url request",
"request": {
"method": "GET",
"header": []
},
"response": []
}
],
"event": [
Expand Down
8 changes: 8 additions & 0 deletions test/resources/input/v21/PostmantoOpenAPI.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@
"description": "Just an example of text raw body"
},
"response": []
},
{
"name": "No url request",
"request": {
"method": "GET",
"header": []
},
"response": []
}
],
"event": [
Expand Down