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

✨ add per-request timeout #604

Merged
merged 2 commits into from
May 2, 2024
Merged

✨ add per-request timeout #604

merged 2 commits into from
May 2, 2024

Conversation

techouse
Copy link
Collaborator

@techouse techouse commented May 1, 2024

This PR adds a new timeout annotation

/// Set a timeout for the request
final Duration? timeout;

that can be used like

@Get(path: 'get_timeout', timeout: Duration(seconds: 42))
Future<Response<String>> getTimeoutTest();

and generates the following code

@override
Future<Response<String>> getTimeoutTest() {
  final Uri $url = Uri.parse('/test/get_timeout');
  final Request $request = Request(
    'GET',
    $url,
    client.baseUrl,
  );
  return client
      .send<String, String>($request)
      .timeout(const Duration(microseconds: 42000000));
}

Addresses #603
Addresses dart-lang/http#1186

@techouse techouse added the enhancement New feature or request label May 1, 2024
@techouse techouse added this to the 8.0.0 milestone May 1, 2024
@techouse techouse removed their assignment May 1, 2024
@techouse techouse linked an issue May 1, 2024 that may be closed by this pull request
@techouse
Copy link
Collaborator Author

techouse commented May 1, 2024

Codecov complaining .... as always.

@JEuler @Guldem @vladRudenua23 would you mind checking this PR 😇

Copy link
Contributor

@Guldem Guldem left a comment

Choose a reason for hiding this comment

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

LGTM! Nice addition

@techouse techouse merged commit c558b3b into develop May 2, 2024
3 of 4 checks passed
@techouse techouse deleted the feat/per-request-timeout branch May 2, 2024 08:09
techouse added a commit that referenced this pull request May 2, 2024
# chopper

## 8.0.0-rc.2

- #604

# chopper_generator

## 8.0.0-rc.2

- #604

# chopper_built_value

## 3.0.0-rc.1

- Require Chopper ^8.0.0
techouse added a commit that referenced this pull request May 3, 2024
# chopper

## 8.0.0-rc.2

- #604

# chopper_generator

## 8.0.0-rc.2

- #604

# chopper_built_value

## 3.0.0-rc.1

- Require Chopper ^8.0.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
techouse added a commit that referenced this pull request May 3, 2024
# chopper

## 8.0.0

- Restructure interceptors ([#547](#547))
- Add per-request timeout ([#604](#604))

# chopper_generator

## 8.0.0

- Restructure interceptors ([#547](#547))
- Add per-request timeout ([#604](#604))

## 3.0.0

- Require Chopper ^8.0.0
@techouse techouse mentioned this pull request May 3, 2024
techouse added a commit that referenced this pull request May 9, 2024
# chopper

## 8.0.0

- Restructure interceptors ([#547](#547))
- Add per-request timeout ([#604](#604))

# chopper_generator

## 8.0.0

- Restructure interceptors ([#547](#547))
- Add per-request timeout ([#604](#604))

## 3.0.0

- Require Chopper ^8.0.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Job Guldemeester <job@dutchcodingcompany.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

timeout for specific request
3 participants