File tree Expand file tree Collapse file tree 2 files changed +3
-10
lines changed Expand file tree Collapse file tree 2 files changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -51,13 +51,10 @@ module.exports = {
51
51
}
52
52
const path = endpoint . replace ( / \{ ( .+ ?) \} / g, ':$1' ) ;
53
53
let handler = this . _handlerBase ( funcConf , httpEvent ) ;
54
- let optionsHandler = this . _optionsHandler ;
55
54
if ( httpEvent . cors ) {
56
55
handler = this . _handlerAddCors ( handler ) ;
57
- optionsHandler = this . _handlerAddCors ( optionsHandler ) ;
58
- }
59
- if ( method !== 'any' ) {
60
- app . options ( path , optionsHandler ) ;
56
+ let optionsHandler = this . _handlerAddCors ( this . _optionsHandler ) ;
57
+ if ( method !== 'any' ) app . options ( path , optionsHandler ) ;
61
58
}
62
59
app [ method === 'any' ? 'all' : method ] (
63
60
path ,
Original file line number Diff line number Diff line change @@ -339,15 +339,11 @@ describe('serve', () => {
339
339
expect ( module . serverless . cli . consoleLog ) . to . have . been . calledWith (
340
340
' POST - http://localhost:8000/test/func2path/{testParam}'
341
341
) ;
342
- expect ( app . options ) . to . have . callCount ( 2 ) ;
342
+ expect ( app . options ) . to . have . callCount ( 1 ) ;
343
343
expect ( app . options . firstCall ) . to . have . been . calledWith (
344
344
'/test/func1path' ,
345
345
testHandlerCors
346
346
) ;
347
- expect ( app . options . secondCall ) . to . have . been . calledWith (
348
- '/test/func2path/:testParam' ,
349
- testHandlerOptions
350
- ) ;
351
347
} ) ;
352
348
353
349
it ( 'should create express handler for all methods for functions with "any" method' , ( ) => {
You can’t perform that action at this time.
0 commit comments