Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issue where formData would sometimes be sent twice #389

Merged
merged 26 commits into from
Feb 3, 2022

Conversation

erunion
Copy link
Member

@erunion erunion commented Feb 3, 2022

🧰 Changes

This resolves a bug I discovered in #380 where if you sent only a metadata object to an x-www-form-urlencoded opration we'd copy that metadata over to being the formData object, ultimately potentially things like path parameters in the body payload.

🧬 QA & Testing

See the test I added for this and the test I updated that had this incorrect behavior as an expectation. Oops.

@erunion erunion added bug Something isn't working area:core Issues related to `core`, which is the package that powers the SDKs at runtime labels Feb 3, 2022
@erunion erunion requested review from a team, Dashron and domharrington and removed request for a team February 3, 2022 00:58
@@ -131,6 +132,7 @@ module.exports = async (operation, body, metadata) => {
// as a metadata object and organize into parameters.
// eslint-disable-next-line no-param-reassign
metadata = body;
metadataIntersected = true;
Copy link
Member Author

Choose a reason for hiding this comment

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

Open to suggestions on a better variable name than this. Basically I just need to know when body was copied to metadata, where what the user sent was a metadata object but since they didn't send a body, and body is the first argument to an operation we need to rewrite it a bit.

It's confusing I know and I'm not explaining it properly.

Base automatically changed from fix/file-uploads to main February 3, 2022 17:55
@erunion erunion merged commit d4e309c into main Feb 3, 2022
@erunion erunion deleted the fix/payload-processing branch February 3, 2022 18:58
@erunion erunion added this to the v5 milestone Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core Issues related to `core`, which is the package that powers the SDKs at runtime bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant