-
-
Notifications
You must be signed in to change notification settings - Fork 105
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
Add support for JSON objects for the non-file fields #278
Comments
I've implemented in #288 Note that in order to be parsed, the content type must be specified:
|
@ShogunPanda I have got this error when using it with typescript: formData.append("metadata", JSON.stringify(data[key][i]), {
contentType: "application/json"
}) even when I tried to ignore the error. I still get the error when submitting form: TypeError: Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'. |
It seems to come from form-data and not from our package. I'm not at PC at the moment, but out of my mind I would try with Let me know if it solves, otherwise on Mon I'll take a second look. |
@ShogunPanda https://developer.mozilla.org/en-US/docs/Web/API/FormData/append |
@meotimdihia Node does not ship |
@ShogunPanda the pack formData.append("metadata", JSON.stringify(data[key][i]), {
contentType: "application/json"
})
And do we have a way to post JSON objects from the browser? |
I'm sorry, but this is not related to I have no idea on your client setup so I can't help. |
I would recommend you open an issue on If you are using the browser default |
Prerequisites
🚀 Feature Proposal
Currently the plugin doesn't support complex JSON objects as non-file field values. It could be an interesting addition to the plugin.
Motivation
A user opened an issue where he is trying to send a JSON object through and then expects that to be validated.
Link to the issue is here: fastify/help#525 (comment)
Example
Below there's the code for both the server and the client (the non-file field in question is the metadata field).
server:
client:
The text was updated successfully, but these errors were encountered: