@@ -524,7 +524,7 @@ describe('Request', function () {
524524 expect ( res . body . id ) . to . equal ( 1 )
525525 } )
526526
527- it ( 'should return request null when param value for a given key does not exists' , function * ( ) {
527+ it ( 'should return null when param value for a given key does not exists' , function * ( ) {
528528 const server = http . createServer ( function ( req , res ) {
529529 const request = new Request ( req , res , Config )
530530 request . _params = { id :1 }
@@ -537,6 +537,20 @@ describe('Request', function () {
537537 expect ( res . body . name ) . to . equal ( null )
538538 } )
539539
540+ it ( 'should return default value when param value for a given key does not exists' , function * ( ) {
541+ const server = http . createServer ( function ( req , res ) {
542+ const request = new Request ( req , res , Config )
543+ request . _params = { id :1 }
544+ const name = request . param ( 'name' , 'bar' )
545+ res . writeHead ( 200 , { "Content-type" :"application/json" } )
546+ res . end ( JSON . stringify ( { name} ) , 'utf8' )
547+ } )
548+
549+ const res = yield supertest ( server ) . get ( "/" ) . expect ( 200 ) . end ( )
550+ expect ( res . body . name ) . to . equal ( 'bar' )
551+ } )
552+
553+
540554 it ( 'should return an uploaded file as an instance of File object' , function * ( ) {
541555 const server = http . createServer ( function ( req , res ) {
542556 var form = new formidable . IncomingForm ( ) ;
0 commit comments