server: avoid overwriting Authorization header (#10878)
Some checks are pending
flake8 Lint / Lint (push) Waiting to run
Python Type-Check / pyright type-check (push) Waiting to run

* server: avoid overwriting Authorization header

If no API key is set, leave the Authorization header as is. It may be
used by another part of the Web stack, such as an authenticating proxy.

Fixes https://github.com/ggerganov/llama.cpp/issues/10854

* rebuild

---------

Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
This commit is contained in:
Gaetan Bisson 2024-12-18 04:00:07 -10:00 committed by GitHub
parent 152610eda9
commit 7bbb5acf12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 1 deletions

Binary file not shown.

View File

@ -445,7 +445,7 @@ const mainApp = createApp({
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Authorization': this.config.apiKey ? `Bearer ${this.config.apiKey}` : undefined, ...(this.config.apiKey ? {'Authorization': `Bearer ${this.config.apiKey}`} : {})
}, },
body: JSON.stringify(params), body: JSON.stringify(params),
signal: abortController.signal, signal: abortController.signal,