JsonResponse retain output value on request error
parent
57886e66d0
commit
8f9b8f779f
|
@ -49,7 +49,7 @@ module.exports = Trait( 'JsonResponse' )
|
||||||
{
|
{
|
||||||
if ( err !== null )
|
if ( err !== null )
|
||||||
{
|
{
|
||||||
callback( err, null );
|
callback( err, resp );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
Loading…
Reference in New Issue