Skip to content

Default trailer to nil in the concrete sendAndFinish - #148

Merged
aryan-25 merged 1 commit into
swift-server:mainfrom
aryan-25:add-default-argument
Oct 16, 2026
Merged

aryan-25 merged 1 commit into
swift-server:mainfrom
aryan-25:add-default-argument

Conversation

@aryan-25

@aryan-25 aryan-25 commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

#136 added a concrete sendAndFinish(_:buffer:trailer:) that writes the head, body and end in a single write.

We should add a default value to the trailer argument so that callers who omit the trailer argument can use this optimised implementation instead of the default implementation provided by HTTPAPIs.

Modifications

Default trailer to nil on the concrete sendAndFinish.

Result

Callers omitting the trailer argument can use the optimised implementation.

### Motivation

swift-server#136 added a concrete `sendAndFinish(_:buffer:trailer:)` that writes the head, body and end in a single write.

We should add a default value to the `trailer` argument so that callers who omit the `trailer` argument can use this optimised implementation instead of the default implementation provided by `HTTPAPIs`.

### Modifications

- Default `trailer` to `nil` on the concrete `sendAndFinish`.

### Result

Calls without `trailer` get the single-write path.
@aryan-25 aryan-25 added the 🆕 semver/minor Adds new public API. label Oct 16, 2026
@fabianfett

Copy link
Copy Markdown
Member

Love it!

@aryan-25
aryan-25 merged commit 91638a7 into swift-server:main Oct 16, 2026
26 of 27 checks passed
@aryan-25
aryan-25 deleted the add-default-argument branch October 16, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🆕 semver/minor Adds new public API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants