Skip to content

Commit

Permalink
refactor: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
dominiq007 committed Feb 14, 2024
1 parent 53fd28c commit ac962b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/router/router.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ export class Router {

if (request.isAjaxRequest()) {
return await this.createResponse(request, JSON.stringify(payload), {
statusCode,
headers: {
'content-type': 'application/json; charset=utf-8',
},
statusCode,
});
}

if (
this.customHttpHandlers.has(undefined) ||
this.customHttpHandlers.has(statusCode)
this.customHttpHandlers.has(statusCode) ||
this.customHttpHandlers.has(undefined)
) {
const body = this.customHttpHandlers.get(
this.customHttpHandlers.has(statusCode) ? statusCode : undefined,
Expand Down Expand Up @@ -193,12 +193,12 @@ export class Router {
'autoplay=(self), camera=(), encrypted-media=(self), geolocation=(self), microphone=(), payment=(), sync-xhr=(self)',
'referrer-policy': 'no-referrer',
'strict-transport-security': 'max-age=31536000; includeSubDomains',
'x-content-type-options': 'nosniff',
'x-dns-prefetch-control': 'off',
'x-xss-protection': '0',
...(!cors.allowedMethods.includes('*') && {
'vary': 'origin',
}),
'x-content-type-options': 'nosniff',
'x-dns-prefetch-control': 'off',
'x-xss-protection': '0',
};

const { body: parsedBody, contentType } = await this.parseResponseBody(
Expand Down Expand Up @@ -257,8 +257,8 @@ export class Router {

private async createSeoRobotsFile(request: HttpRequest): Promise<Response> {
const directives: [string, string][] = [
['User-agent', '*'],
['Allow', '*'],
['User-agent', '*'],
];

if (this.configurator.entries.seo.sitemap) {
Expand All @@ -281,8 +281,8 @@ export class Router {
private async createSeoSitemapFile(request: HttpRequest): Promise<Response> {
const directUrlInvalidChars = [
'\\',
':',
'?',
':',
'*',
'+',
'^',
Expand Down Expand Up @@ -533,7 +533,7 @@ export class Router {
);

if (taskSchedule) {
this.scheduler.schedule(taskSchedule[0], taskSchedule[1], async () => {
this.scheduler.schedule(...taskSchedule, async () => {
const methodResult = controllerMethod.call(controllerInstance);

if (methodResult instanceof Promise) {
Expand Down Expand Up @@ -760,10 +760,10 @@ export class Router {
errors,
}),
{
statusCode: HttpStatus.BadRequest,
headers: {
'content-type': 'application/json; charset=utf-8',
},
statusCode: HttpStatus.BadRequest,
},
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/server.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ export class Server implements Disposable {
}

throw new Error(
`Port ${this.configurator.entries.port} is already in use. Try port ${getAvailablePort()}`,
`Port ${this.configurator.entries.port} is already in use. Try out port ${getAvailablePort()}`,
);
}

Expand Down

0 comments on commit ac962b6

Please sign in to comment.