Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/jasonkneen/RESTe
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkneen committed Dec 3, 2018
2 parents a048d10 + 1340622 commit 4e4c5ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -462,13 +462,13 @@ Using the following config you can configure end points that will still work as
get: 'classes/locations?where={"name": "<name>"}'
}, {
name: "updateLocation",
put: "classes/locations/<objectId>"
put: "classes/locations/<id>"
}, {
name: "createLocation",
post: "classes/locations/"
}, {
name: "deleteLocation",
delete: "classes/locations/<objectId>"
delete: "classes/locations/<id>"
}]
```

Expand Down
19 changes: 12 additions & 7 deletions reste.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ var main = function() {

function retry() {
log('Retrying...');
makeHttpRequest(args, onLoad, onError);
return makeHttpRequest(args, onLoad, onError);
}

var error;
Expand Down Expand Up @@ -226,7 +226,7 @@ var main = function() {
} else {
send();
}

return http;
}

// set Requestheaders
Expand Down Expand Up @@ -338,7 +338,7 @@ var main = function() {
}
});

makeHttpRequest({
return makeHttpRequest({
url : url,
method : method,
params : body,
Expand Down Expand Up @@ -370,7 +370,7 @@ var main = function() {
throw 'RESTe :: missing parameter/s ' + missing + ' for method ' + args.name;
} else {

makeHttpRequest({
return makeHttpRequest({
url : url,
method : method,
params : body,
Expand Down Expand Up @@ -587,10 +587,15 @@ var main = function() {

if (modelConfig.content) {

var results = e[modelConfig.content];
var result = e[modelConfig.content];

if (results.length === 1) {
options.success(results[0]);
if (result.length === 1) {
//result is an array with value as first entry
options.success(result[0]);
}
else {
//result is not an array
options.success(result);
}
} else {
// calls error handler if we have it defined and 201+ returned
Expand Down

0 comments on commit 4e4c5ee

Please sign in to comment.