mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-09 10:56:52 +08:00
fix basic auth encoding (#18047)
Signed-off-by: kenwoodjw <blackxin55+@gmail.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import base64
|
||||||
import json
|
import json
|
||||||
from collections.abc import Mapping
|
from collections.abc import Mapping
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
@@ -259,7 +260,9 @@ class Executor:
|
|||||||
if self.auth.config.type == "bearer":
|
if self.auth.config.type == "bearer":
|
||||||
headers[authorization.config.header] = f"Bearer {authorization.config.api_key}"
|
headers[authorization.config.header] = f"Bearer {authorization.config.api_key}"
|
||||||
elif self.auth.config.type == "basic":
|
elif self.auth.config.type == "basic":
|
||||||
headers[authorization.config.header] = f"Basic {authorization.config.api_key}"
|
credentials = authorization.config.api_key
|
||||||
|
encoded_credentials = base64.b64encode(credentials.encode("utf-8")).decode("utf-8")
|
||||||
|
headers[authorization.config.header] = f"Basic {encoded_credentials}"
|
||||||
elif self.auth.config.type == "custom":
|
elif self.auth.config.type == "custom":
|
||||||
headers[authorization.config.header] = authorization.config.api_key or ""
|
headers[authorization.config.header] = authorization.config.api_key or ""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user