-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
[x ] bug report
I should be able to mock a fake backend service using a primary id of my model object as "0". Instead, it always returns a "404" error in that case. The cause is an "if" conditional in InMemoryBackendService.prototype.delete method. "0" evaluates as falsey which causes the method to execute "this.createErrorResponse(http_status_codes_1.STATUS.NOT_FOUND...)". It also appears that "put" and "post" have similar issues.
Existing framework code:
InMemoryBackendService.prototype.delete = function (_a) {
var id = _a.id, collection = _a.collection, collectionName = _a.collectionName, headers = _a.headers;
if (!id) { //<---- Right here is the issue, id "0" evaluates as "falsey"
return this.createErrorResponse(http_status_codes_1.STATUS.NOT_FOUND, "Missing \"" + collectionName + "\" id");
}
var exists = this.removeById(collection, id);
return new http_1.ResponseOptions({
headers: headers,
status: (exists || !this.config.delete404) ? http_status_codes_1.STATUS.NO_CONTENT : http_status_codes_1.STATUS.NOT_FOUND
});
};
- Angular version: 2.0.0-rc.4
- Browser: all
- Language: all
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels