File tree 2 files changed +5
-17
lines changed
2 files changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -143,8 +143,8 @@ function session(options) {
143
143
secret = [ secret ] ;
144
144
}
145
145
146
- if ( ! secret ) {
147
- deprecate ( 'req. secret; provide secret option ') ;
146
+ if ( secret === undefined ) {
147
+ throw new Error ( ' secret is required for sessions ') ;
148
148
}
149
149
150
150
// notify user that this store is not
@@ -207,7 +207,7 @@ function session(options) {
207
207
208
208
// backwards compatibility for signed cookies
209
209
// req.secret is passed from the cookie parser middleware
210
- var secrets = secret || [ req . secret ] ;
210
+ var secrets = secret ;
211
211
212
212
var originalHash ;
213
213
var originalId ;
Original file line number Diff line number Diff line change @@ -35,20 +35,8 @@ describe('session()', function(){
35
35
. expect ( 200 , done )
36
36
} )
37
37
38
- it ( 'should error without secret' , function ( done ) {
39
- request ( createServer ( { secret : undefined } ) )
40
- . get ( '/' )
41
- . expect ( 500 , / s e c r e t .* r e q u i r e d / , done )
42
- } )
43
-
44
- it ( 'should get secret from req.secret' , function ( done ) {
45
- function setup ( req ) {
46
- req . secret = 'keyboard cat'
47
- }
48
-
49
- request ( createServer ( setup , { secret : undefined } ) )
50
- . get ( '/' )
51
- . expect ( 200 , '' , done )
38
+ it ( 'should reject without secret' , function ( ) {
39
+ assert . throws ( session . bind ( null , { secret : undefined } ) , / s e c r e t .* r e q u i r e d / )
52
40
} )
53
41
54
42
it ( 'should create a new session' , function ( done ) {
You can’t perform that action at this time.
0 commit comments