Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
rename response helper. fixes #47
Browse files Browse the repository at this point in the history
  • Loading branch information
vernak2539 committed May 19, 2015
1 parent 780fe86 commit 5165e2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions lib/fuel-rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ FuelRest.prototype.apiRequest = function( options, callback ) {
var localError, retry, authOptions;

if( err ) {
helpers.deliverResponse( 'error', err, callback, 'FuelAuth' );
helpers.respond( 'error', err, callback, 'FuelAuth' );
return;
}

// if there's no access token we have a problem
if( !body.accessToken ) {
localError = new Error( 'No access token' );
localError.res = body;
helpers.deliverResponse( 'error', localError, callback, 'FuelAuth' );
helpers.respond( 'error', localError, callback, 'FuelAuth' );
return;
}

Expand All @@ -110,7 +110,7 @@ FuelRest.prototype.apiRequest = function( options, callback ) {
var parsedBody;

if( err ) {
helpers.deliverResponse( 'error', err, callback, 'Request Module inside apiRequest' );
helpers.respond( 'error', err, callback, 'Request Module inside apiRequest' );
return;
}

Expand All @@ -123,7 +123,7 @@ FuelRest.prototype.apiRequest = function( options, callback ) {

// checking to make sure it's json from api
if( !res.headers[ 'content-type' ] || res.headers[ 'content-type' ].split( ';' )[ 0 ].toLowerCase() !== 'application/json' ) {
helpers.deliverResponse( 'error', new Error( 'API did not return JSON' ), callback, 'Fuel REST' );
helpers.respond( 'error', new Error( 'API did not return JSON' ), callback, 'Fuel REST' );
return;
}

Expand All @@ -134,7 +134,7 @@ FuelRest.prototype.apiRequest = function( options, callback ) {
parsedBody = body;
}

helpers.deliverResponse( 'response', { res: res, body: parsedBody }, callback );
helpers.respond( 'response', { res: res, body: parsedBody }, callback );

}.bind( this ) );

Expand Down
2 changes: 1 addition & 1 deletion lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {

return is401 && isFailureFromBadToken;
}
, deliverResponse: function( type, data, callback, errorFrom ) {
, respond: function( type, data, callback, errorFrom ) {

// if it's an error and we have where it occured, let's tack it on
if( type === 'error' ) {
Expand Down

0 comments on commit 5165e2f

Please sign in to comment.