mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 14:45:56 +08:00
fix: update bearer to capital case and handle undefined (#7226)
This commit is contained in:
parent
cb2c492618
commit
816cae3aac
@ -9,19 +9,21 @@ const create = async (
|
|||||||
): Promise<SuccessResponse<PayloadProps> | ErrorResponse> => {
|
): Promise<SuccessResponse<PayloadProps> | ErrorResponse> => {
|
||||||
try {
|
try {
|
||||||
let httpConfig = {};
|
let httpConfig = {};
|
||||||
|
const username = props.username ? props.username.trim() : '';
|
||||||
|
const password = props.password ? props.password.trim() : '';
|
||||||
|
|
||||||
if (props.username !== '' && props.password !== '') {
|
if (username !== '' && password !== '') {
|
||||||
httpConfig = {
|
httpConfig = {
|
||||||
basic_auth: {
|
basic_auth: {
|
||||||
username: props.username,
|
username,
|
||||||
password: props.password,
|
password,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else if (props.username === '' && props.password !== '') {
|
} else if (username === '' && password !== '') {
|
||||||
httpConfig = {
|
httpConfig = {
|
||||||
authorization: {
|
authorization: {
|
||||||
type: 'bearer',
|
type: 'Bearer',
|
||||||
credentials: props.password,
|
credentials: password,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -9,18 +9,21 @@ const editWebhook = async (
|
|||||||
): Promise<SuccessResponse<PayloadProps> | ErrorResponse> => {
|
): Promise<SuccessResponse<PayloadProps> | ErrorResponse> => {
|
||||||
try {
|
try {
|
||||||
let httpConfig = {};
|
let httpConfig = {};
|
||||||
if (props.username !== '' && props.password !== '') {
|
const username = props.username ? props.username.trim() : '';
|
||||||
|
const password = props.password ? props.password.trim() : '';
|
||||||
|
|
||||||
|
if (username !== '' && password !== '') {
|
||||||
httpConfig = {
|
httpConfig = {
|
||||||
basic_auth: {
|
basic_auth: {
|
||||||
username: props.username,
|
username,
|
||||||
password: props.password,
|
password,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else if (props.username === '' && props.password !== '') {
|
} else if (username === '' && password !== '') {
|
||||||
httpConfig = {
|
httpConfig = {
|
||||||
authorization: {
|
authorization: {
|
||||||
type: 'bearer',
|
type: 'Bearer',
|
||||||
credentials: props.password,
|
credentials: password,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -9,19 +9,21 @@ const testWebhook = async (
|
|||||||
): Promise<SuccessResponse<PayloadProps> | ErrorResponse> => {
|
): Promise<SuccessResponse<PayloadProps> | ErrorResponse> => {
|
||||||
try {
|
try {
|
||||||
let httpConfig = {};
|
let httpConfig = {};
|
||||||
|
const username = props.username ? props.username.trim() : '';
|
||||||
|
const password = props.password ? props.password.trim() : '';
|
||||||
|
|
||||||
if (props.username !== '' && props.password !== '') {
|
if (username !== '' && password !== '') {
|
||||||
httpConfig = {
|
httpConfig = {
|
||||||
basic_auth: {
|
basic_auth: {
|
||||||
username: props.username,
|
username,
|
||||||
password: props.password,
|
password,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else if (props.username === '' && props.password !== '') {
|
} else if (username === '' && password !== '') {
|
||||||
httpConfig = {
|
httpConfig = {
|
||||||
authorization: {
|
authorization: {
|
||||||
type: 'bearer',
|
type: 'Bearer',
|
||||||
credentials: props.password,
|
credentials: password,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user