Skip to content

Commit 82a1f8f

Browse files
Merge pull request nestjs#6602 from koenpunt/fix-CORS-origin
fix: update CORS origin type
2 parents 8582b66 + 0980efc commit 82a1f8f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

packages/common/interfaces/external/cors-options.interface.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
type StaticOrigin = boolean | string | RegExp | (string | RegExp)[];
2+
13
/**
24
* Set origin to a function implementing some custom logic. The function takes the
35
* request origin as the first parameter and a callback (which expects the signature
@@ -9,7 +11,7 @@
911
*/
1012
export type CustomOrigin = (
1113
requestOrigin: string,
12-
callback: (err: Error | null, allow?: boolean) => void,
14+
callback: (err: Error | null, origin?: StaticOrigin) => void,
1315
) => void;
1416

1517
/**
@@ -22,7 +24,7 @@ export interface CorsOptions {
2224
/**
2325
* Configures the `Access-Control-Allow-Origins` CORS header. See [here for more detail.](https://github.com/expressjs/cors#configuration-options)
2426
*/
25-
origin?: boolean | string | RegExp | (string | RegExp)[] | CustomOrigin;
27+
origin?: StaticOrigin | CustomOrigin;
2628
/**
2729
* Configures the Access-Control-Allow-Methods CORS header.
2830
*/

0 commit comments

Comments
 (0)