Skip to content

I can't define the Content-Type of a field in a MultipartRequest #1765

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

Open
stefv opened this issue May 3, 2025 · 1 comment
Open

I can't define the Content-Type of a field in a MultipartRequest #1765

stefv opened this issue May 3, 2025 · 1 comment
Labels
package:http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@stefv
Copy link

stefv commented May 3, 2025

Using Postman and Spring Web doing REST. I can define in Postman the Content-Type of a field and it's perfectly accepted by the server. But with "http", it's always sent as "text/plain; charset=utf-8" because, it's ASCII.

I would like to set the Content-Type like application/json for my JSON.

Here the problem in http:

String _headerForField(String name, String value) { var header = 'content-disposition: form-data; name="${_browserEncode(name)}"'; if (!isPlainAscii(value)) { header = '$header\r\n' 'content-type: text/plain; charset=utf-8\r\n' 'content-transfer-encoding: binary'; } return '$header\r\n\r\n'; }

@stefv stefv added package:http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels May 3, 2025
@stefv
Copy link
Author

stefv commented May 3, 2025

I did an evolution with a MultipartField and a MultipartRequestEx. But i'm not sure it's the way used by the Dart team to upgrade the code libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:http type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

1 participant