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(form-data): handling array items #1336

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

BijanRegmi
Copy link

Status

READY

Description

Fixes: #845

Formdata only supports either string or blob types. So items of an array should be converted to string before adding them to the form.

Todos

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

@melloware melloware added the bug Something isn't working label Apr 29, 2024
@melloware melloware added this to the 6.28.0 milestone Apr 29, 2024
melloware
melloware previously approved these changes Apr 29, 2024
Copy link

@hariacharya80 hariacharya80 left a comment

Choose a reason for hiding this comment

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

Nice catch!

@melloware
Copy link
Collaborator

Looks like a formatting issue. Can you run npm run format please?

@Ultre00
Copy link

Ultre00 commented May 13, 2024

I see that the approved changes sets the data as a JSON string when itemSchema.type === 'object', This gets rid of the error, but doesn't realy make it form-data. Shouldn't each of the properties of the object also be iterated? And also add an array suffix to the key?

So that the end result looks something like this for the form data key: <arrayFieldName>[<arrayIndex>].<objectPropertyName>

@melloware melloware modified the milestones: 6.28.0, 6.29.0, 6.30.0 May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TS Error: argument of type 'number' is not assignable to parameter of type 'string | Blob'
4 participants