Skip to content

fix: handle json content type in delete tenant#956

Merged
ferhatelmas merged 1 commit intomasterfrom
ferhat/delete-tenant-empty-json
Mar 31, 2026
Merged

fix: handle json content type in delete tenant#956
ferhatelmas merged 1 commit intomasterfrom
ferhat/delete-tenant-empty-json

Conversation

@ferhatelmas
Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Refactor, bug fix.

What is the current behavior?

While deleting a tenant in admin app, if content-type is set to json, body is needed.

What is the new behavior?

Body isn't needed but also there is no need to fail the request. Make it permissive to accept empty json body.

Additional context

Can be seen related to #953 partially due to implementation but the reason is completely different (client convenience here vs genuine bug).

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
@ferhatelmas ferhatelmas requested a review from a team as a code owner March 31, 2026 15:33
Copilot AI review requested due to automatic review settings March 31, 2026 15:33
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the admin tenant DELETE endpoint permissive when clients send Content-Type: application/json with an empty body, avoiding JSON parsing failures and improving client convenience for the admin app.

Changes:

  • Encapsulate the admin tenant DELETE route and override the JSON content-type parser to treat an empty body as null while preserving normal JSON parsing when a body is present.
  • Add a regression test ensuring an empty JSON DELETE request succeeds and returns 204.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/http/routes/admin/tenants.ts Adds an encapsulated application/json parser override for the tenant DELETE route to allow empty JSON bodies.
src/test/admin-tenants.test.ts Adds a test verifying DELETE /tenants/:tenantId accepts Content-Type: application/json with an empty payload and returns 204.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 23805755274

Details

  • 26 of 27 (96.3%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 80.446%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/http/routes/admin/tenants.ts 26 27 96.3%
Totals Coverage Status
Change from base Build 23799232545: 0.04%
Covered Lines: 29800
Relevant Lines: 36864

💛 - Coveralls

@ferhatelmas ferhatelmas merged commit 46cd89c into master Mar 31, 2026
9 checks passed
@ferhatelmas ferhatelmas deleted the ferhat/delete-tenant-empty-json branch March 31, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants