Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/in-memory-backend.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,9 @@ export class InMemoryBackendService {
return createObservableResponse(reqInfo.req, resOptions);
}

protected delete({ id, collection, collectionName, headers, req }: RequestInfo) {
if (!id) {
protected delete({id, collection, collectionName, headers, req}: RequestInfo) {
// tslint:disable-next-line:triple-equals
if (id == undefined) {
return createErrorResponse(req, STATUS.NOT_FOUND, `Missing "${collectionName}" id`);
}
const exists = this.removeById(collection, id);
Expand All @@ -517,10 +518,11 @@ export class InMemoryBackendService {
protected get({ id, query, collection, collectionName, headers, req }: RequestInfo) {
let data = collection;

if (id) {
data = this.findById(collection, id);
} else if (query) {
// tslint:disable-next-line:triple-equals
if (id == undefined) {
data = this.applyQuery(collection, query);
} else if (query) {
data = this.findById(collection, id);
}

if (!data) {
Expand Down