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 (
|
||||
|
||||
Reference in New Issue
Block a user