retrofit.dart icon indicating copy to clipboard operation
retrofit.dart copied to clipboard

Add requestUri support

Open marinat opened this issue 5 years ago • 11 comments

I try to send parameters like this: @GET("/users") Future<UsersResponse> getUsers( { @Query("id") List<String>ids); I wait request like this /v2/users?id=5&id=7, But got this: /v2/users?id=%5b%5d5&id=%5b%5d7

Description of dio https://developpaper.com/flutter-http-library-dio-2-1-was-officially-released/ says that in such case we must use uri. How to fix this?

marinat avatar Jan 22 '20 16:01 marinat

currently, the lib doesn't support requestUri. You have to use dio invoke this method directly.

trevorwang avatar Jan 23 '20 03:01 trevorwang

I'll use interceptor as workaround. And when is it planned to add?

marinat avatar Jan 23 '20 06:01 marinat

I am working on other urgent issues right now. I will spend effort on this when I get time.

trevorwang avatar Feb 06 '20 07:02 trevorwang

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[bot] avatar Feb 22 '20 04:02 stale[bot]

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[bot] avatar Mar 09 '20 01:03 stale[bot]

Is this feature realized, or just closed?

marinat avatar Apr 20 '20 15:04 marinat

It's closed automatically by the robot.

It needs a lot of refactoring work to implement this feature. I have to do changes almost for every single method in generator package.

It may affect the stability of this package. Considering adding this functionality in a future release. Will let you know when I finished this.

trevorwang avatar Apr 21 '20 01:04 trevorwang

Thanks for quick answer. I'll be wait.

marinat avatar Apr 21 '20 06:04 marinat

I'm facing with this problem too

hautvfami avatar May 19 '20 11:05 hautvfami

@hautvfami temporary solution - make request manually

marinat avatar May 19 '20 13:05 marinat

There's another solution I've found, which is to make use of @Queries() Map<String, dynamic> params.

And then create the queries map like this:

final params = {
    'skills[]': ['1', '2'],
};

and if you don't need the brackets, then simply remove and the result will be skills=1&skills=2

douglasiacovelli avatar Nov 05 '21 18:11 douglasiacovelli