Skip to content

Commit

Permalink
Merge pull request #25 from destebanm/patch-1
Browse files Browse the repository at this point in the history
Improve success handling
  • Loading branch information
inorganik authored Jul 26, 2016
2 parents 1219f05 + 53b598b commit c434c1f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions digestAuthRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,12 @@
// increment nonce count
self.nc++;
// return data
if (self.authenticatedRequest.responseText !== 'undefined') {
if (self.authenticatedRequest.responseText.length > 0) {
// If JSON, parse and return object
if (self.isJson(self.authenticatedRequest.responseText)) {
self.successFn(JSON.parse(self.authenticatedRequest.responseText));
} else {
self.successFn(self.authenticatedRequest.responseText);
}
if (self.authenticatedRequest.responseText !== 'undefined' && self.authenticatedRequest.responseText.length > 0 ) {
// If JSON, parse and return object
if (self.isJson(self.authenticatedRequest.responseText)) {
self.successFn(JSON.parse(self.authenticatedRequest.responseText));
} else {
self.successFn(self.authenticatedRequest.responseText);
}
} else {
self.successFn();
Expand Down

0 comments on commit c434c1f

Please sign in to comment.