mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat: Add new credentials for the HTTP Request node (#9833)
Co-authored-by: Jonathan Bennetts <jonathan.bennetts@gmail.com> Co-authored-by: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com>
This commit is contained in:
@@ -21,21 +21,13 @@ export async function elasticSecurityApiRequest(
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
) {
|
||||
const {
|
||||
username,
|
||||
password,
|
||||
baseUrl: rawBaseUrl,
|
||||
} = (await this.getCredentials('elasticSecurityApi')) as ElasticSecurityApiCredentials;
|
||||
const { baseUrl: rawBaseUrl } = (await this.getCredentials(
|
||||
'elasticSecurityApi',
|
||||
)) as ElasticSecurityApiCredentials;
|
||||
|
||||
const baseUrl = tolerateTrailingSlash(rawBaseUrl);
|
||||
|
||||
const token = Buffer.from(`${username}:${password}`).toString('base64');
|
||||
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Authorization: `Basic ${token}`,
|
||||
'kbn-xsrf': true,
|
||||
},
|
||||
method,
|
||||
body,
|
||||
qs,
|
||||
@@ -52,7 +44,7 @@ export async function elasticSecurityApiRequest(
|
||||
}
|
||||
|
||||
try {
|
||||
return await this.helpers.request(options);
|
||||
return await this.helpers.requestWithAuthentication.call(this, 'elasticSecurityApi', options);
|
||||
} catch (error) {
|
||||
if (error?.error?.error === 'Not Acceptable' && error?.error?.message) {
|
||||
error.error.error = `${error.error.error}: ${error.error.message}`;
|
||||
|
||||
Reference in New Issue
Block a user