fix: send profile auth headers when fetching the OpenAPI spec - #22
fix: send profile auth headers when fetching the OpenAPI spec#22itsyoboieltr wants to merge 2 commits into
Conversation
|
Thanks for the fix, @itsyoboieltr - the problem was real (a spec behind auth could not be loaded at all) and your two commits are kept verbatim, with your authorship, in #23, which supersedes this PR. A cross-review found two things on top of your change that are fixed there: the profile headers were also forwarded to external Closing this one in favour of #23. |
fix: send profile auth headers when fetching the OpenAPI spec (supersedes #22)
Summary
Profile auth settings (
--api-basic-auth,--api-bearer-token,--custom-headers) were only applied to API requests, not when fetching the OpenAPI spec itself. A spec behind authentication (e.g./openapi.jsonreturning 401) could not be loaded.What changed
OpenapiLoader.loadSpec()accepts an optionalheadersoption, passed to the axios request for the spec and any external $ref documentsbuildProfileAuthHeaders(profile)in cli.ts: merges custom headers and adds the Basic/Bearer Authorization headerloadSpeccall sites (profiles add, API commands, command list/search) now pass the profile auth headersbuildHeaders()reuses the same helper, so request behavior is unchangedVerification