Add optional `baseURL` override to Configuration by josebet1 · Pull Request #119 · MethodFi/method-node
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a caller passes baseURL: '' (e.g., from an unset env var), the opts.baseURL check is falsy so validation is skipped, but the constructor still uses the empty string because ?? does not fall back on ''. This results in Configuration.baseURL being empty, and later new URL(${request.baseURL}${request.url}) in src/resource.ts throws for relative-only URLs, breaking all requests at runtime. Consider treating empty/whitespace strings as invalid or falling back to the env default.
Useful? React with 👍 / 👎.