fix(axios): map options.form to URL-encoded body in httpRequest (#196)#199
fix(axios): map options.form to URL-encoded body in httpRequest (#196)#199SAY-5 wants to merge 3 commits into
Conversation
…-strava#196) Signed-off-by: SAY-5 <say.apm35@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe PR adds form data support to the axios utility by serializing ChangesForm Data Support for axios Migration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #196.
The
request→axiosmigration translatedoptions.bodytoconfig.databut lost theoptions.formpath.pushSubscriptions.create(and any other call site that hands the payload to the HTTP client asform) therefore POSTed an empty body, Strava'spush_subscriptionsendpoint silently rejected the request as missing required fields.Restore the request-promise semantics: when
options.formis present andoptions.bodyis not, build aURLSearchParamsand setContent-Type: application/x-www-form-urlencoded. Existingbody-based callers continue to useconfig.dataunchanged.Regression test
should POST URL-encoded fields, not an empty bodycaptures the POST body vianockand asserts each form field round-trips, fails onmainwithactual undefined, passes after the fix. Existing 8 pushSubscriptions tests + eslint also green.Summary by CodeRabbit
Bug Fixes
Tests