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

It is possible to decode all responses to UTF-8 using interceptResponse? #120

Open
Greismorr opened this issue Dec 15, 2022 · 7 comments
Open
Assignees
Labels
question Further information is requested wontfix This will not be worked on

Comments

@Greismorr
Copy link

Greismorr commented Dec 15, 2022

Currently, my interceptResponse looks like:

@override
  Future<ResponseData> interceptResponse({required ResponseData data}) async {
    if (kDebugMode) {
      print("-- RESPONSE --");
      print(data.body);
    }

    RequestExceptionCatcher.checkRequestResponse(
      data.statusCode,
    );

    data.body = utf8.decode(data.bodyBytes);

    return data;
  }

The problem is that the response body are not changing. Even when i manually set the body value to an empty string, the response.body outside of the intercepter is not changing.

@Greismorr Greismorr added the question Further information is requested label Dec 15, 2022
@CodingAleCR
Copy link
Owner

Sorry that it has taken me this long to reply.

In short, I think the library should be able to change it. I will take a look at it as soon as I can and get back on it. Probably in a 2.0.0 release though.

@Greismorr
Copy link
Author

No problem, thanks for the update!

@stale
Copy link

stale bot commented Apr 2, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Apr 2, 2023
@stale stale bot closed this as completed May 4, 2023
@CodingAleCR CodingAleCR reopened this May 4, 2023
@stale stale bot removed the wontfix This will not be worked on label May 4, 2023
@CodingAleCR
Copy link
Owner

Usually, the encoding used for the body directly corresponds to the encoding tied to the Request you built. [By default it is utf-8, you can check out the behavior of this variable in the docs.

Now, if your server is not sending it using the encoding you set, then it might be an issue with the server and not the client(your flutter/dart app)

@CodingAleCR
Copy link
Owner

Now in other notes, #124 should take care of changing the body, but it is far from a feature implemented. Sorry about that 😞

@Greismorr
Copy link
Author

That's fine. It would be cool to change the body but it's not something that's impossible to address elsewhere in the code.

Your package is awesome :)

@stale
Copy link

stale bot commented Sep 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants