Skip to content

Add guard clause for API key validation in AzureOpenAIEndpoint #338088

Description

While reviewing the AzureOpenAIEndpoint class, I noticed that header generation proceeds without validating whether the API key or Entra ID token (this._apiKey) is actually present.

To improve defensive programming and fail early with a clear error when credentials are missing, I'd like to introduce a guard clause at the beginning of the getExtraHeaders() method.

Proposed Changes:

  • Add a check for this._apiKey in getExtraHeaders() to throw an explicit error if missing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions