Skip to content

Commit 71fa4e1

Browse files
authored
[5.3] DELETE should return 204 if item don't exist (joomla#45589)
1 parent 62a22cc commit 71fa4e1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

libraries/src/MVC/Controller/ApiController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,6 @@ public function delete($id = null)
301301
if ($model->getError() !== false) {
302302
throw new \RuntimeException($model->getError(), 500);
303303
}
304-
305-
throw new \RuntimeException(Text::_('JLIB_APPLICATION_ERROR_DELETE'), 500);
306304
}
307305

308306
$this->app->setHeader('status', 204);

tests/System/integration/api/com_contact/Contacts.cy.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ describe('Test that contacts API endpoint', () => {
4242

4343
it('can delete a contact', () => {
4444
cy.db_createContact({ name: 'automated test contact', published: -2 })
45-
.then((contact) => cy.api_delete(`/contacts/${contact.id}`));
45+
.then((contact) => cy.api_delete(`/contacts/${contact.id}`))
46+
.then((result) => expect(result.status).to.eq(204));
47+
});
48+
49+
it('check correct response for delete a not existent contact', () => {
50+
cy.api_delete('/contacts/9999')
51+
.then((result) => expect(result.status).to.eq(204));
4652
});
4753

4854
it('can submit a contact form', () => {

0 commit comments

Comments
 (0)