[Security Solution][Serverless] Add HTTP header 'x-elastic-internal-product' to e2e Role/User loader (#163026)

## Summary

- Adds http header `x-elastic-internal-product` to the calls made form
the Role/User loader to create the roles in cypress tests
This commit is contained in:
Paul Tavares 2023-08-02 17:38:47 -04:00 committed by GitHub
parent 2c6fd26f5e
commit c0030da51b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,10 @@ const ignoreHttp409Error = (error: AxiosError) => {
throw error;
};
const DEFAULT_HEADERS = Object.freeze({
'x-elastic-internal-product': 'security-solution',
});
export interface LoadedRoleAndUser {
role: string;
username: string;
@ -75,6 +79,9 @@ export class RoleAndUserLoader<R extends Record<string, Role> = Record<string, R
.request({
method: 'PUT',
path: `/api/security/role/${roleName}`,
headers: {
...DEFAULT_HEADERS,
},
body: roleDefinition,
})
.catch(ignoreHttp409Error)
@ -104,6 +111,9 @@ export class RoleAndUserLoader<R extends Record<string, Role> = Record<string, R
.request({
method: 'POST',
path: `/internal/security/users/${username}`,
headers: {
...DEFAULT_HEADERS,
},
body: user,
})
.catch(ignoreHttp409Error)