Skip to content

Commit

Permalink
fix linting pt3
Browse files Browse the repository at this point in the history
  • Loading branch information
despadam committed Jul 31, 2024
1 parent a193ccd commit 60b151f
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/jobs/actions/urlaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export class URLAction<T> implements JobAction<T> {

private urlTemplate: Handlebars.TemplateDelegate<JobClass>;
private method = "GET";
private headerTemplates?: Record<string, Handlebars.TemplateDelegate<JobClass>> = {};
private headerTemplates?: Record<
string,
Handlebars.TemplateDelegate<JobClass>
> = {};
private bodyTemplate?: Handlebars.TemplateDelegate<JobClass>;

getActionType(): string {
Expand All @@ -59,13 +62,16 @@ export class URLAction<T> implements JobAction<T> {
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]) => [

Check failure on line 66 in src/jobs/actions/urlaction.ts

View workflow job for this annotation

GitHub Actions / eslint

Insert `··`
key,

Check failure on line 67 in src/jobs/actions/urlaction.ts

View workflow job for this annotation

GitHub Actions / eslint

Insert `··`
template(job, jobTemplateOptions),

Check failure on line 68 in src/jobs/actions/urlaction.ts

View workflow job for this annotation

GitHub Actions / eslint

Insert `··`
]),

Check failure on line 69 in src/jobs/actions/urlaction.ts

View workflow job for this annotation

GitHub Actions / eslint

Insert `··`
)

Check failure on line 70 in src/jobs/actions/urlaction.ts

View workflow job for this annotation

GitHub Actions / eslint

Insert `··`
: undefined,
body: this.bodyTemplate
? this.bodyTemplate(job, jobTemplateOptions)
: undefined,
});

Logger.log(`Request for ${url} returned ${response.status}`, "URLAction");
Expand Down Expand Up @@ -103,8 +109,10 @@ export class URLAction<T> implements JobAction<T> {
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]) => [
Expand Down

0 comments on commit 60b151f

Please sign in to comment.