1
0
Fork 0

JsonResponse retain output value on request error

master
Mike Gerwitz 2015-05-28 11:03:57 -04:00
parent 57886e66d0
commit 8f9b8f779f
2 changed files with 5 additions and 4 deletions

View File

@ -49,7 +49,7 @@ module.exports = Trait( 'JsonResponse' )
{ {
if ( err !== null ) if ( err !== null )
{ {
callback( err, null ); callback( err, resp );
return; return;
} }

View File

@ -85,14 +85,15 @@ describe( 'dapi.format.JsonRepsonse trait', function()
it( 'proxy error from encapsulated DataApi', function( done ) it( 'proxy error from encapsulated DataApi', function( done )
{ {
var e = Error( 'foo' ); var e = Error( 'foo' ),
chk = {};
_createStubbedDapi( e, '0' ) _createStubbedDapi( e, chk )
.request( '', function( err, data ) .request( '', function( err, data )
{ {
// data should also be cleared out // data should also be cleared out
expect( err ).to.equal( e ); expect( err ).to.equal( e );
expect( data ).to.equal( null ); expect( data ).to.equal( chk );
done(); done();
} ); } );
} ); } );