lejard-h / chopper

Chopper is an http client generator using source_gen and inspired from Retrofit.
https://hadrien-lejard.gitbook.io/chopper
Other
714 stars 123 forks source link

timeout for specific request #603

Closed vladRudenua23 closed 7 months ago

vladRudenua23 commented 7 months ago

Hi it will be better to provide an option for request to set timeout for waiting requests (i'm not talking about connection timeout). Manually, i can do that, but when I'm running Build Runner, I need to make this "modification" again.

for example, my user_network_service.chopper.dart

  @override
  Future<Response<UserModel>> profile() {
    final Uri $url = Uri.parse('/user/profile');
    final Request $request = Request(
      'GET',
      $url,
      client.baseUrl,
    );
    return client
        .send<UserModel, UserModel>($request)
        .timeout(Duration(seconds: 5));
  }
techouse commented 7 months ago

Hey,

Thanks for the proposal! I'll try to implement it.

techouse commented 7 months ago

@vladRudenua23 would you mind test-driving PR #604 🙏

Can you please play around with the master branch and see if it fixes your issue?