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

Query param error #151

Closed
juanagu opened this issue Dec 29, 2022 · 2 comments
Closed

Query param error #151

juanagu opened this issue Dec 29, 2022 · 2 comments

Comments

@juanagu
Copy link

juanagu commented Dec 29, 2022

Hello, I'm trying to use the next params

const params = {
      'response_type': 'token',
      'display': 'page',
      'extras': {'setup':{'channel':'IG_API_ONBOARDING'}},
    };

The function params2qs should check if the value is String before to do a v.trim()

@juanagu
Copy link
Author

juanagu commented Dec 29, 2022

Possible solution:

params.forEach((k, v) {
      String val;
      if (v is List) {
        val = Uri.encodeComponent(v.map((p) => p.trim()).join(' '));
      } else if (v is Map) {
        val = jsonEncode(v);
      } else {
        val = v.toString().trim();
      }
      qsList.add(k + '=' + val);
});

@okrad
Copy link
Collaborator

okrad commented Jan 25, 2023

@juanagu thank you, you are right, I will add the patch in the next release

@okrad okrad closed this as completed in 067f7cc Jan 26, 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

No branches or pull requests

2 participants