Skip to content
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

Fixing multi value headers so they are serialized correctly #1586

Closed
wants to merge 2 commits into from

Conversation

bradtalabat
Copy link
Contributor

New Pull Request Checklist

  • I have read the Documentation
  • I have searched for a similar pull request in the project and found none
  • I have updated this branch with the latest develop to avoid conflicts (via merge from master or rebase)
  • I have added the required tests to prove the fix/feature I am adding
  • I have updated the documentation (if necessary)
  • I have run the tests and they pass

This merge request fixes / refers to the following issues: There was a change in version 4.0.1 that converted request header to their string values. This breaks multi value request headers as the get serialized like this [value1,value2] instead of like this value1,value2

Pull Request Description

Change has been made to use the previous code, which worked in 4.0.0. This bug was found after upgrading from 4.0.0 to 4.0.6

@bradtalabat bradtalabat changed the title Fixing multi value headers so the are serialized correctly Fixing multi value headers so they are serialized correctly Oct 30, 2022
@@ -74,6 +74,17 @@ Future<void> startServer() async {
return;
}

if (path == '/multi-value-header') {
response.headers.contentType = ContentType('application', 'json');
response.headers.add("x-multi-value-request-header-echo", request.headers.value("x-multi-value-request-header").toString());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use single quotes here like this:

response.headers.add('x-multi-value-request-header-echo', request.headers.value('x-multi-value-request-header').toString());

@AlexV525
Copy link
Member

Hi everyone! We've made our hardfork repo public and published a new version of dio, named diox.
The new package contains the PR of the fix.
Please refer to https://pub.dev/packages/diox/versions/5.0.0-dev.1 to use the fork.
You can also see why we're working for a hardfork at cfug/diox#29 and #1607.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants