mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Fix edit / view of webhook contact point when no authorization is set (#71965)
This commit is contained in:
parent
63346674e6
commit
6d1ff7f416
@ -34,6 +34,11 @@ describe('normalizeFormValues', () => {
|
||||
|
||||
expect(normalizeFormValues(config)).toEqual(createContactPoint({ bearer_token_file: 'file' }));
|
||||
});
|
||||
|
||||
it('should normalize even if authorization is not defined', () => {
|
||||
const config = createContactPoint({});
|
||||
expect(normalizeFormValues(config)).toEqual(createContactPoint({}));
|
||||
});
|
||||
});
|
||||
|
||||
function createContactPoint(httpConfig: DeprecatedAuthHTTPConfig | HTTPAuthConfig) {
|
||||
|
@ -8,7 +8,7 @@ export interface DeprecatedAuthHTTPConfig {
|
||||
}
|
||||
|
||||
export interface HTTPAuthConfig {
|
||||
authorization: {
|
||||
authorization?: {
|
||||
type: string;
|
||||
credentials?: string;
|
||||
credentials_file?: string;
|
||||
@ -42,8 +42,8 @@ function normalizeHTTPConfig(config: HTTPAuthConfig | DeprecatedAuthHTTPConfig):
|
||||
|
||||
return {
|
||||
...omit(config, 'authorization'),
|
||||
bearer_token: config.authorization.credentials,
|
||||
bearer_token_file: config.authorization.credentials_file,
|
||||
bearer_token: config.authorization?.credentials,
|
||||
bearer_token_file: config.authorization?.credentials_file,
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user