diff --git a/src/jobs/actions/urlaction.ts b/src/jobs/actions/urlaction.ts index d19eeedd3..b02e32b94 100644 --- a/src/jobs/actions/urlaction.ts +++ b/src/jobs/actions/urlaction.ts @@ -42,7 +42,10 @@ export class URLAction implements JobAction { private urlTemplate: Handlebars.TemplateDelegate; private method = "GET"; - private headerTemplates?: Record> = {}; + private headerTemplates?: Record< + string, + Handlebars.TemplateDelegate + > = {}; private bodyTemplate?: Handlebars.TemplateDelegate; getActionType(): string { @@ -59,13 +62,16 @@ export class URLAction implements JobAction { const response = await fetch(url, { method: this.method, headers: this.headerTemplates - ? Object.fromEntries( - Object.entries(this.headerTemplates).map(([key, template]) => [ - key, - template(job, jobTemplateOptions), - ]) - ) : undefined, - body: this.bodyTemplate ? this.bodyTemplate(job, jobTemplateOptions) : undefined, + ? Object.fromEntries( + Object.entries(this.headerTemplates).map(([key, template]) => [ + key, + template(job, jobTemplateOptions), + ]), + ) + : undefined, + body: this.bodyTemplate + ? this.bodyTemplate(job, jobTemplateOptions) + : undefined, }); Logger.log(`Request for ${url} returned ${response.status}`, "URLAction"); @@ -103,8 +109,10 @@ export class URLAction implements JobAction { this.method = data.method; } if (data["headers"]) { - if(!isStringRecord(data.headers)) { - throw new NotFoundException("Param 'headers' should map strings to strings"); + if (!isStringRecord(data.headers)) { + throw new NotFoundException( + "Param 'headers' should map strings to strings", + ); } this.headerTemplates = Object.fromEntries( Object.entries(data.headers).map(([key, value]) => [