Skip to content

Commit 67295a9

Browse files
committed
Ref: minor, shortening.
1 parent 1d29db9 commit 67295a9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

express-zod-api/src/routing.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ export interface Routing {
2424

2525
export type Parsers = Partial<Record<ContentType, RequestHandler[]>>;
2626

27-
const lineUp = (methods: Array<CORSMethod>) =>
27+
const lineUp = (methods: CORSMethod[]) =>
2828
methods // auxiliary methods go last
2929
.sort((a, b) => +isMethod(b) - +isMethod(a) || a.localeCompare(b))
3030
.join(", ")
3131
.toUpperCase();
3232

3333
/** @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405 */
3434
export const createWrongMethodHandler =
35-
(allowedMethods: Array<CORSMethod>): RequestHandler =>
35+
(allowedMethods: CORSMethod[]): RequestHandler =>
3636
({ method }, res, next) => {
3737
const Allow = lineUp(allowedMethods);
3838
res.set({ Allow }); // in case of a custom errorHandler configured that does not care about headers in error
@@ -42,7 +42,7 @@ export const createWrongMethodHandler =
4242
next(error);
4343
};
4444

45-
const makeCorsHeaders = (accessMethods: Array<CORSMethod>) => ({
45+
const makeCorsHeaders = (accessMethods: CORSMethod[]) => ({
4646
"Access-Control-Allow-Origin": "*",
4747
"Access-Control-Allow-Methods": lineUp(accessMethods),
4848
"Access-Control-Allow-Headers": "content-type",

0 commit comments

Comments
 (0)