Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: danwrong/restler
base: master
...
head fork: martintajur/restler
compare: master
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/restler.js
View
9 lib/restler.js
@@ -368,12 +368,15 @@ var parsers = {
},
json: function(data, callback) {
if (data && data.length) {
+ var err;
try {
- callback(null, JSON.parse(data));
- } catch (err) {
+ data = JSON.parse(data);
+ err = null;
+ } catch (caughtErr) {
+ err = caughtErr;
err.message = 'Failed to parse JSON body: ' + err.message;
- callback(err, null);
}
+ callback(err, data);
} else {
callback(null, null);
}

No commit comments for this range

Something went wrong with that request. Please try again.