Skip to content

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

Merged
felipefreitag merged 3 commits into
resend:canaryfrom
wesleyramalho:fix/delete-method-consistency
May 18, 2026
Merged

refactor: align delete method with other HTTP methods in Resend class#904
felipefreitag merged 3 commits into
resend:canaryfrom
wesleyramalho:fix/delete-method-consistency

Conversation

@wesleyramalho
Copy link
Copy Markdown
Contributor

@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. Adds options/header support and only sends a body when provided; preserves falsy payloads.

  • Refactors

    • Added and exported DeleteOptions.
    • delete(path, query?, options?) merges custom headers with defaults.
    • Omits body when query is undefined.
  • Bug Fixes

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

Written for commit 2fa1a1e. Summary will update on new commits. Review in cubic

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.

Comment thread src/resend.ts Outdated
Avoid omitting valid falsy payloads (null, 0, "", false) by using
an explicit `=== undefined` check instead of a truthiness check.
@wesleyramalho
Copy link
Copy Markdown
Contributor 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.

@wesleyramalho
Copy link
Copy Markdown
Contributor Author

@felipevolpone let me know if there's anything else I should change in this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 28, 2026

Open in StackBlitz

npm i https://pkg.pr.new/resend@904

commit: 2fa1a1e

@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label May 16, 2026
@felipefreitag felipefreitag merged commit 24950d7 into resend:canary May 18, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants