diff --git a/src/dapi/format/JsonResponse.js b/src/dapi/format/JsonResponse.js index d0f08fe..49ebe9e 100644 --- a/src/dapi/format/JsonResponse.js +++ b/src/dapi/format/JsonResponse.js @@ -49,7 +49,7 @@ module.exports = Trait( 'JsonResponse' ) { if ( err !== null ) { - callback( err, null ); + callback( err, resp ); return; } diff --git a/test/dapi/format/JsonResponseTest.js b/test/dapi/format/JsonResponseTest.js index 6360562..633a93f 100644 --- a/test/dapi/format/JsonResponseTest.js +++ b/test/dapi/format/JsonResponseTest.js @@ -85,14 +85,15 @@ describe( 'dapi.format.JsonRepsonse trait', function() 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 ) { // data should also be cleared out expect( err ).to.equal( e ); - expect( data ).to.equal( null ); + expect( data ).to.equal( chk ); done(); } ); } );