Closed Dragollla closed 1 year ago
As I mentioned in https://github.com/joolfe/postman-to-openapi/issues/136#issuecomment-1281939719, Appending 'http://' before variable results in hostname being incorrectly parsed. It leads to servers section containing invalid URL http://
servers
http://
> url.parse('http://{{baseUrl}}api/path') Url { protocol: 'http:', slashes: true, auth: null, host: '', port: null, hostname: '', hash: null, search: null, query: null, pathname: '%7B%7BbaseUrl%7D%7Dapi/path', path: '%7B%7BbaseUrl%7D%7Dapi/path', href: 'http:///%7B%7BbaseUrl%7D%7Dapi/path' }
I suggest using whatwg-url parser:
> new URL('http://{{baseUrl}}api/path') URL { href: 'http://{{baseurl}}api/path', origin: 'http://{{baseurl}}api', protocol: 'http:', username: '', password: '', host: '{{baseurl}}api', hostname: '{{baseurl}}api', port: '', pathname: '/path', search: '', searchParams: URLSearchParams {}, hash: '' }
It happens on 2.7.1.
Sorry, my teammate has patched and broke library, and I didn't realize it till now
As I mentioned in https://github.com/joolfe/postman-to-openapi/issues/136#issuecomment-1281939719, Appending 'http://' before variable results in hostname being incorrectly parsed. It leads to
servers
section containing invalid URLhttp://
I suggest using whatwg-url parser:
It happens on 2.7.1.