-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
The request headers key changes to lowercase #2002
Comments
HTTP headers are defined as being case insensitive, which means What exactly, is your problem @hnsycsxhzcsh ? |
The way I write it is:
dio.options.headers["Authorization"] = "Basic <token>";
But the reality is:
I want the argument in the request header to be Authorization instead of authorization. What should I do?
陈少华
***@***.***
…------------------ 原始邮件 ------------------
发件人: "cfug/dio" ***@***.***>;
发送时间: 2023年10月21日(星期六) 晚上9:56
***@***.***>;
***@***.******@***.***>;
主题: Re: [cfug/dio] The request headers key changes to lowercase (Issue #2002)
HTTP headers are defined as being case insensitive, which means Authorization and authorization are identical.
What exactly, is your problem @hnsycsxhzcsh ?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
This comment was marked as duplicate.
This comment was marked as duplicate.
I understand that, but why does it need to start with an upper case A? |
The server interface is not compatible with lowercase, the server cannot change, the client needs to pass uppercase
陈少华
***@***.***
…------------------ 原始邮件 ------------------
发件人: "cfug/dio" ***@***.***>;
发送时间: 2023年10月23日(星期一) 下午3:01
***@***.***>;
***@***.******@***.***>;
主题: Re: [cfug/dio] The request headers key changes to lowercase (Issue #2002)
I understand that, but why does it need to start with an upper case A?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I've tried to solve this multiple times and ended up with a complicated but different solution every time. I'll try again to see if I can make any difference this time. P.S. We've been involved with customized headers and headers from the io package, which causes a significant amount of transformation code has be written during the implementation. |
Fixes #2002 #1102 #788 #641 ### New Pull Request Checklist - [x] I have read the [Documentation](https://pub.dev/documentation/dio/latest/) - [x] I have searched for a similar pull request in the [project](https://github.com/cfug/dio/pulls) and found none - [x] I have updated this branch with the latest `main` branch to avoid conflicts (via merge from master or rebase) - [x] I have added the required tests to prove the fix/feature I'm adding - [x] I have updated the documentation (if necessary) - [x] I have run the tests without failures - [x] I have updated the `CHANGELOG.md` in the corresponding package ### Additional context and info (if any) We have `camelCaseContentDisposition` for `FormData` but this is not related. --------- Signed-off-by: Alex Li <[email protected]>
Request Statement
When I made a network request, Authorization was added to the network request headers, but the result was changed to lowercase.
example:
var dio = Dio(); Options options = Options(headers: {"Authorization": "Basic xxx"}); Response response = await dio.get(“xxx” options: options, );
Solution Brainstorm
No response
The text was updated successfully, but these errors were encountered: