fix(ims-client): use application/x-www-form-urlencoded instead of multipart/form-data#1757
Open
ravverma wants to merge 2 commits into
Open
fix(ims-client): use application/x-www-form-urlencoded instead of multipart/form-data#1757ravverma wants to merge 2 commits into
ravverma wants to merge 2 commits into
Conversation
…pplication/x-www-form-urlencoded IMS flagged that requests using multipart/form-data are breaking. The native FormData API sends multipart/form-data, while OAuth/token endpoints expect application/x-www-form-urlencoded. Switch createFormData to use URLSearchParams which natively encodes as x-www-form-urlencoded. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…encoding Nock parses x-www-form-urlencoded bodies into objects before calling function matchers, so multipart-style string matching no longer works. Update all body matchers to use direct property access instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
This PR will trigger a patch release when merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
multipart/form-dataare breakingFormDataAPI (used viacreateFormData) causes fetch to sendmultipart/form-dataautomatically — even whennoContentType: trueis set, since fetch overrides the header for FormData bodiesapplication/x-www-form-urlencodedcreateFormDatato return aURLSearchParamsobject, which fetch encodes asapplication/x-www-form-urlencoded; charset=utf-8automaticallyimsApiCallPOST requests:validateAccessToken,getServiceAccessToken,getServiceAccessTokenV3,getServicePrincipalAccessToken,getProductContextByImsOrgIdTest plan
createFormDataunit test to assertURLSearchParamsoutputincludes org_id in the POST body to IMS token v3test body matcher for the new encodingcontent-type: application/x-www-form-urlencodedin nock debug output for POST requests🤖 Generated with Claude Code