mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix: HTTP Request tool - do not error on missing headers (#10044)
This commit is contained in:
parent
b42f652f1b
commit
04b62e0398
|
@ -49,7 +49,8 @@ const genericCredentialRequest = async (ctx: IExecuteFunctions, itemIndex: numbe
|
||||||
const headerAuth = await ctx.getCredentials('httpHeaderAuth', itemIndex);
|
const headerAuth = await ctx.getCredentials('httpHeaderAuth', itemIndex);
|
||||||
|
|
||||||
return async (options: IHttpRequestOptions) => {
|
return async (options: IHttpRequestOptions) => {
|
||||||
options.headers![headerAuth.name as string] = headerAuth.value;
|
if (!options.headers) options.headers = {};
|
||||||
|
options.headers[headerAuth.name as string] = headerAuth.value;
|
||||||
return await ctx.helpers.httpRequest(options);
|
return await ctx.helpers.httpRequest(options);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -58,9 +59,7 @@ const genericCredentialRequest = async (ctx: IExecuteFunctions, itemIndex: numbe
|
||||||
const queryAuth = await ctx.getCredentials('httpQueryAuth', itemIndex);
|
const queryAuth = await ctx.getCredentials('httpQueryAuth', itemIndex);
|
||||||
|
|
||||||
return async (options: IHttpRequestOptions) => {
|
return async (options: IHttpRequestOptions) => {
|
||||||
if (!options.qs) {
|
if (!options.qs) options.qs = {};
|
||||||
options.qs = {};
|
|
||||||
}
|
|
||||||
options.qs[queryAuth.name as string] = queryAuth.value;
|
options.qs[queryAuth.name as string] = queryAuth.value;
|
||||||
return await ctx.helpers.httpRequest(options);
|
return await ctx.helpers.httpRequest(options);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue