@@ -205,12 +205,31 @@ test('Strict routing distinguishes trailing slash', function(t) {
205
205
server . get ( '/no-trailing' , noop ) ;
206
206
207
207
var trailing = server . router . routes . GET [ 0 ] ;
208
- t . ok ( trailing . path . test ( '/trailing/' ) ) ;
209
- t . notOk ( trailing . path . test ( '/trailing' ) ) ;
208
+ t . ok ( trailing . path . test ( '/trailing/' ) , 'Single trailing slash is ok' ) ;
209
+ t . notOk ( trailing . path . test ( '/trailing' ) , 'No trailing slash is not ok' ) ;
210
+ t . notOk (
211
+ trailing . path . test ( '/trailing//' ) ,
212
+ 'Double trailing slash is not ok'
213
+ ) ;
214
+ t . notOk (
215
+ trailing . path . test ( '//trailing/' ) ,
216
+ 'Double heading slash is not ok'
217
+ ) ;
210
218
211
219
var noTrailing = server . router . routes . GET [ 1 ] ;
212
- t . ok ( noTrailing . path . test ( '/no-trailing' ) ) ;
213
- t . notOk ( noTrailing . path . test ( '/no-trailing/' ) ) ;
220
+ t . ok ( noTrailing . path . test ( '/no-trailing' , 'No trailing slash is ok' ) ) ;
221
+ t . notOk (
222
+ noTrailing . path . test ( '/no-trailing/' ) ,
223
+ 'Single trailing slash is not ok'
224
+ ) ;
225
+ t . notOk (
226
+ noTrailing . path . test ( '/no-trailing//' ) ,
227
+ 'Double trailing slash is not ok'
228
+ ) ;
229
+ t . notOk (
230
+ noTrailing . path . test ( '//no-trailing' ) ,
231
+ 'Double heading slash is not ok'
232
+ ) ;
214
233
215
234
t . end ( ) ;
216
235
} ) ;
@@ -223,14 +242,25 @@ test('Default non-strict routing ignores trailing slash(es)', function(t) {
223
242
server . get ( '/no-trailing' , noop ) ;
224
243
225
244
var trailing = server . router . routes . GET [ 0 ] ;
226
- t . ok ( trailing . path . test ( '/trailing/' ) ) ;
227
- t . ok ( trailing . path . test ( '//trailing//' ) ) ;
228
- t . ok ( trailing . path . test ( '/trailing' ) ) ;
245
+ t . ok ( trailing . path . test ( '/trailing/' , 'Single trailing slash is ok' ) ) ;
246
+ t . ok ( trailing . path . test ( '/trailing' ) , 'No trailing slash is not ok' ) ;
247
+ t . notOk (
248
+ trailing . path . test ( '/trailing//' ) ,
249
+ 'Double trailing slash is not ok'
250
+ ) ;
251
+ t . notOk ( trailing . path . test ( '//trailing' ) , 'Double heading slash is not ok' ) ;
229
252
230
253
var noTrailing = server . router . routes . GET [ 1 ] ;
231
- t . ok ( noTrailing . path . test ( '/no-trailing' ) ) ;
232
- t . ok ( noTrailing . path . test ( '//no-trailing//' ) ) ;
233
- t . ok ( noTrailing . path . test ( '/no-trailing/' ) ) ;
254
+ t . ok ( noTrailing . path . test ( '/no-trailing' , 'No trailing slash is ok' ) ) ;
255
+ t . ok ( noTrailing . path . test ( '/no-trailing/' ) , 'Single trailing slash is ok' ) ;
256
+ t . notOk (
257
+ noTrailing . path . test ( '/no-trailing//' ) ,
258
+ 'Double trailing slash is not ok'
259
+ ) ;
260
+ t . notOk (
261
+ noTrailing . path . test ( '//no-trailing' ) ,
262
+ 'Double heading slash is not ok'
263
+ ) ;
234
264
235
265
t . end ( ) ;
236
266
} ) ;
0 commit comments