Commit 6ec16cf0 by heheer Committed by GitHub

fix: mcp header auth type selection (#6246)

parent 97717ae9
......@@ -39,6 +39,11 @@ export const getSecretValue = ({
const { secret, value } = val;
const actualValue = value || decryptSecret(secret);
// Filter out empty values to avoid invalid headers
if (!actualValue || !key) {
return acc;
}
if (key === HeaderSecretTypeEnum.Bearer) {
acc['Authorization'] = `Bearer ${actualValue}`;
} else if (key === HeaderSecretTypeEnum.Basic) {
......
......@@ -87,9 +87,9 @@ const AuthValueDisplay = ({
};
export const getSecretType = (config: HeaderSecretConfigType): HeaderSecretTypeEnum => {
if (config.Bearer && (config.Bearer.secret || config.Bearer.value)) {
if (config.Bearer) {
return HeaderSecretTypeEnum.Bearer;
} else if (config.Basic && (config.Basic.secret || config.Basic.value)) {
} else if (config.Basic) {
return HeaderSecretTypeEnum.Basic;
} else if (config.customs && config.customs.length > 0) {
return HeaderSecretTypeEnum.Custom;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment