fix(directAccess): Properly handle response status (#6966)
* fix(directAccess): Properly handle response status * clean up * handle status in batch
This commit is contained in:
@@ -64,6 +64,11 @@ function ParseServerRESTController(applicationId, router) {
|
||||
config
|
||||
).then(
|
||||
response => {
|
||||
if (options.returnStatus) {
|
||||
const status = response._status;
|
||||
delete response._status;
|
||||
return { success: response, _status: status };
|
||||
}
|
||||
return { success: response };
|
||||
},
|
||||
error => {
|
||||
@@ -117,8 +122,13 @@ function ParseServerRESTController(applicationId, router) {
|
||||
return router.tryRouteRequest(method, path, request);
|
||||
})
|
||||
.then(
|
||||
response => {
|
||||
resolve(response.response, response.status, response);
|
||||
resp => {
|
||||
const { response, status } = resp;
|
||||
if (options.returnStatus) {
|
||||
resolve({ ...response, _status: status });
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
},
|
||||
err => {
|
||||
if (
|
||||
|
||||
@@ -1704,7 +1704,8 @@ RestWrite.prototype.runAfterSaveTrigger = function () {
|
||||
RestWrite.prototype.location = function () {
|
||||
var middle =
|
||||
this.className === '_User' ? '/users/' : '/classes/' + this.className + '/';
|
||||
return this.config.mount + middle + this.data.objectId;
|
||||
const mount = this.config.mount || this.config.serverURL;
|
||||
return mount + middle + this.data.objectId;
|
||||
};
|
||||
|
||||
// A helper to get the object id for this operation.
|
||||
|
||||
Reference in New Issue
Block a user