Dart (Flutter) dio library
is more convenient compared to other commonly used HTTP libraries because it allows for easy handling of cancellations, GET parameters, timeouts, JSON, etc.
However, in version 3.x, there is an issue where all HTTP headers are sent in lowercase.
In other words,
await Dio().get(
endpointUrl,
options: Options(
headers: {
'Authorization': 'xxxxxx'
}
),
);
if you write it like this, the actual header will be authorization: xxxxxx
.
Some servers may not recognize the header.
https://github.com/flutterchina/dio/issues/641
This issue is discussed here, and while the RFC states that headers should be treated case-insensitively, in reality, some server-side implementations may distinguish between cases, making it challenging for such use cases.
However, this might be fixed in the upcoming V 4.0.0, which is currently under a pull request. Let's wait and see.
https://github.com/flutterchina/dio/pull/1082
Incidentally, when I switched to the http library and tested, the headers were also converted to lowercase in the same way.
Comments