Repository navigation
fix(webhook): strip transport options from send() payloads - #2857
Conversation
Co-authored-by: Michael Brooks <21328+mwbrooks@users.noreply.github.com> Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
🦋 Changeset detectedLatest commit: 3b5239c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2857 +/- ##
==========================================
+ Coverage 94.25% 94.33% +0.08%
==========================================
Files 67 67
Lines 10808 10809 +1
Branches 680 683 +3
==========================================
+ Hits 10187 10197 +10
+ Misses 590 580 -10
- Partials 31 32 +1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| // Remove transport options so they don't leak into payloads | ||
| const { fetch: _fetch, timeout: _timeout, retryConfig: _retryConfig, ...messagePayload } = payload; |
There was a problem hiding this comment.
thought (non-blocking): `send({ timeout })` still type-checks but quietly does nothing, since only the constructor's `timeout` and `retryConfig` are used. Could be worth a follow-up to drop these from `IncomingWebhookSendArguments` or honour them per call.
There was a problem hiding this comment.
🧭 Opened #2860 to honour them per call, since dropping them from IncomingWebhookSendArguments would break TypeScript code that passes them.
|
🌟 Thanks for the kind review and merge @mwbrooks! |
Summary
This pull request stops
IncomingWebhook.send()from posting thetimeoutandretryConfigoptions in the message payload.IncomingWebhookSendArgumentsextends the default arguments, sosend({ text, timeout, retryConfig })type-checks. The constructor removed these options from its defaults, but options given tosend()were merged in afterward and posted as is, e.g.{"text":"hello","timeout":100,"retryConfig":{...}}.send(), after the merge, so options from both the constructor andsend()are dropped.{ text: 'hello' }, and a patch changeset.This lands before #2688, which adds
loggerandlogLevelto the same options and will add them to this list. Thanks to @mwbrooks for catching it!Testing
main(the payload includestimeoutandretryConfig) and passes with this change.does not leak retryConfig into the posted payloadtest still passes for options given to the constructor.Requirements
🤖 Generated with Claude Code