Skip to content

Allow HTTPClientRequest to be executed multiple times if body is an AsyncSequence #620

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

Merged
merged 1 commit into from
Aug 23, 2022

Conversation

dnadoba
Copy link
Collaborator

@dnadoba dnadoba commented Aug 22, 2022

Motivation

AsyncSequence.makeAsyncIterator() was only called once during the creation of HTTPClientRequest.Body and would have been shared if an HTTPClientRequest is executed a second time.

Modification

  • call AsyncSequence.makeAsyncIterator() for each invocation of HTTPClient.execute
  • create a test which would previously fail

Result

We no longer share the AsyncIterator between different request executions. If the given AsyncSequence actually supports multiple iterators, and therefore can be correctly used by multiple request executions, depends on the concrete type though.

@dnadoba dnadoba added the 🔨 semver/patch No public API change. label Aug 22, 2022
@dnadoba dnadoba force-pushed the dn-async-sequence-reuse branch from 2b9e96c to 68d200e Compare August 22, 2022 18:17
@Lukasa Lukasa merged commit 9c7ab03 into swift-server:main Aug 23, 2022
@dnadoba dnadoba deleted the dn-async-sequence-reuse branch August 23, 2022 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants