Description
We have a func (cv *CredentialValidator) Middleware {} method that responsible for the auth to the proxy. This method is super complicated with a lot of branches. We can refactor this to increase readability because the method is super important. But before this we should create integration tests with generic cases to access /llm proxy endpoints.
Example but we can think about more cases here:
• Authentication & Authorization Failures:
• Auth/Failure/NoToken
• Auth/Failure/InvalidToken
• Auth/Failure/MalformedAuthorizationHeader
• Auth/Failure/InactiveCredential
• Auth/Failure/CredentialNotAssociatedWithApp
• Configuration:
• Config/Failure/InactiveLLM
• Config/Failure/NonExistentLLM
• Request/Failure/InvalidJSONBody
And the thing is that each LLM vendor has different ways to accept token(different header names or query params) which we support and after that we could add vendor specific tests with covering target cases. Like can request for Google AI can be authenticated with valid "x-goog-api-key" value?
Only after adding generic & vendor specific integration tests we could think about refactoring Middleware
Description
We have a func (cv *CredentialValidator) Middleware {} method that responsible for the auth to the proxy. This method is super complicated with a lot of branches. We can refactor this to increase readability because the method is super important. But before this we should create integration tests with generic cases to access /llm proxy endpoints.
Example but we can think about more cases here:
And the thing is that each LLM vendor has different ways to accept token(different header names or query params) which we support and after that we could add vendor specific tests with covering target cases. Like can request for Google AI can be authenticated with valid "x-goog-api-key" value?
Only after adding generic & vendor specific integration tests we could think about refactoring
Middleware