File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
tests/unit/rest/middleware Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -105,21 +105,21 @@ export const cors = (options?: CorsOptions): Middleware => {
105
105
config . maxAge . toString ( )
106
106
) ;
107
107
}
108
- allowedMethods . forEach ( ( method ) => {
108
+ for ( const method of allowedMethods ) {
109
109
reqCtx . res . headers . append ( 'access-control-allow-methods' , method ) ;
110
- } ) ;
111
- allowedHeaders . forEach ( ( header ) => {
110
+ }
111
+ for ( const header of allowedHeaders ) {
112
112
reqCtx . res . headers . append ( 'access-control-allow-headers' , header ) ;
113
- } ) ;
113
+ }
114
114
return new Response ( null , {
115
115
status : HttpErrorCodes . NO_CONTENT ,
116
116
headers : reqCtx . res . headers ,
117
117
} ) ;
118
118
}
119
119
120
- config . exposeHeaders . forEach ( ( header ) => {
120
+ for ( const header of config . exposeHeaders ) {
121
121
reqCtx . res . headers . append ( 'access-control-expose-headers' , header ) ;
122
- } ) ;
122
+ }
123
123
124
124
await next ( ) ;
125
125
} ;
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ describe('CORS Middleware', () => {
197
197
corsConfig . allowMethods
198
198
) ;
199
199
expect ( result . multiValueHeaders ?. [ 'access-control-allow-headers' ] ) . toEqual (
200
- corsConfig . allowHeaders
200
+ corsConfig . allowHeaders . map ( ( header ) => header . toLowerCase ( ) )
201
201
) ;
202
202
expect ( result . headers ?. [ 'access-control-max-age' ] ) . toEqual (
203
203
corsConfig . maxAge . toString ( )
You can’t perform that action at this time.
0 commit comments