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

Make ResponseDecoder return nullable String type #1581

Closed
wants to merge 2 commits into from

Conversation

huhx
Copy link

@huhx huhx commented Oct 21, 2022

This PR make the ResponseDecoder return nullable String

In options.dart:

typedef ResponseDecoder = String Function(
    List<int> responseBytes, RequestOptions options, ResponseBody responseBody);

The usage of this function: src/transformer.dart

String? responseBody;
if (options.responseDecoder != null) {
  responseBody = options.responseDecoder!(
    responseBytes,
    options,
    response..stream = Stream.empty(),
  );
} else {
  responseBody = utf8.decode(responseBytes, allowMalformed: true);
}

As we can see the responseBody is nullable, it means ResponseDecoder function return String? may be make sense.

Copy link
Member

@AlexV525 AlexV525 left a comment

Choose a reason for hiding this comment

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

LGTM. Merging to the fork.

@AlexV525
Copy link
Member

Hi @huhx. 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.

@huhx
Copy link
Author

huhx commented Dec 20, 2022

Hi @huhx. 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.

Great works, thank you.

@AlexV525 AlexV525 closed this Feb 13, 2023
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.

None yet

3 participants