axios-http2-adapter
axios-http2-adapter copied to clipboard
`BaseURL` axios config property not used for `isHTTP2Supported`
When the axios instance in use has a baseURL
set, this isn't factored into the URL that this library uses to check if HTTP2 is supported. This seems to result in an error like:
{
status: 'rejected',
reason: TypeError [ERR_INVALID_URL]: Invalid URL
at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
at new NodeError (node:internal/errors:405:5)
at new URL (node:internal/url:676:13)
at isHTTP2Supported ([...]/node_modules/axios-http2-adapter/dist/adapter.js:51:17)
[...]
input: '/api/v1/[...]',
code: 'ERR_INVALID_URL'
}
}
Looking at the code, I would think this might be a one-liner of const url: URL = new URL(config.baseURL || config.url!);
but don't know the axios internals all that well.