-
Notifications
You must be signed in to change notification settings - Fork 123
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
[Feature Request] Change auto generate header from http #505
Labels
Comments
MirzaHimamiHanif
changed the title
Change auto generate header from http
[Feature Request] Change auto generate header from http
Sep 28, 2023
Hey 👋 I see. You want to remove the charset when the body is in bytes ( In that case, would this do http.Request toHttpRequest() {
final http.Request request = http.Request(method, url)
..followRedirects = followRedirects;
if (body == null) {
request.headers.addAll(headers);
} else {
if (body is String) {
request
..headers.addAll(headers)
..body = body;
} else if (body is List<int>) {
request
..bodyBytes = body
..headers.addAll(headers);
} else if (body is Map<String, String>) {
request
..headers.addAll(headers)
..bodyFields = body;
} else {
throw ArgumentError.value('$body', 'body');
}
}
return request;
} |
@MirzaHimamiHanif check if #508 fixes your problem |
Yes, thanks |
Cool, I'll add some unit tests to the PR and then merge it :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature request related to a problem? Please describe.
http forced to add header with
; charset=utf-8
when doing request and I want my header without it.Describe the solution you'd like
Need to change the order of http.Request(). First add the body then add the header.
Describe alternatives you've considered
No
Additional context
Before
After
The text was updated successfully, but these errors were encountered: