Skip to content

refactor: align delete method with other HTTP methods in Resend class#904

Open
wesleyramalho wants to merge 2 commits intoresend:canaryfrom
wesleyramalho:fix/delete-method-consistency
Open

refactor: align delete method with other HTTP methods in Resend class#904
wesleyramalho wants to merge 2 commits intoresend:canaryfrom
wesleyramalho:fix/delete-method-consistency

Conversation

@wesleyramalho
Copy link
Copy Markdown

@wesleyramalho wesleyramalho commented Apr 1, 2026

The delete method was inconsistent with post, get, put, and patch — it didn't support custom headers/options and unconditionally stringified the body even when undefined. Now follows the same pattern.


Summary by cubic

Aligns the delete method with other HTTP methods in Resend by adding options/header support and only sending a body when provided. Uses a strict undefined check to preserve valid falsy payloads.

  • Refactors

    • Added and exported DeleteOptions interface.
    • delete() accepts options, merges custom headers with defaults.
    • Only stringifies query when defined; omits body otherwise.
  • Bug Fixes

    • Use === undefined check so null, 0, "", and false are sent correctly.

Written for commit cad9aa8. Summary will update on new commits.

The `delete` method was inconsistent with `post`, `get`, `put`, and
`patch` — it didn't support custom headers/options and unconditionally
stringified the body even when undefined. Now follows the same pattern.
@wesleyramalho wesleyramalho requested a review from a team as a code owner April 1, 2026 13:28
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 3 files

Confidence score: 3/5

  • There is a concrete regression risk in src/resend.ts: DELETE body serialization now uses a truthiness check on query, which can drop valid falsy payloads (for example 0 or false).
  • Given the 5/10 severity with high confidence (9/10), this is a moderate user-impacting behavior change rather than a merge-blocking failure, so the PR carries some risk.
  • Pay close attention to src/resend.ts - ensure DELETE request body handling preserves intentionally provided falsy values.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/resend.ts">

<violation number="1" location="src/resend.ts:225">
P2: DELETE body serialization now incorrectly omits valid falsy payloads due to a truthiness check on `query`.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Avoid omitting valid falsy payloads (null, 0, "", false) by using
an explicit `=== undefined` check instead of a truthiness check.
@wesleyramalho
Copy link
Copy Markdown
Author

@cubic-dev-ai can you review again?

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai bot commented Apr 2, 2026

@cubic-dev-ai can you review again?

@wesleyramalho I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

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.

1 participant