fix(directAccess): Properly handle response status (#6966)

* fix(directAccess): Properly handle response status

* clean up

* handle status in batch
This commit is contained in:
Diamond Lewis
2020-10-25 12:34:50 -05:00
committed by GitHub
parent 12abae8f41
commit e89cf25bc2
3 changed files with 81 additions and 3 deletions

View File

@@ -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 (

View File

@@ -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.