apple / apple/swift-http-api-proposal
Make middlewares work with result builders
- Dominant language
- Swift
- Stars
- 66
- Forks
- 21
- Avg merge
- 7h 39m
- Merged PRs (30d)
- 2
Description
The existing prototype in the Middleware module doesn't yet work correctly, this issue tracks being able to write something like:
```swift
try await server.serve(
handler: terminalHandler
) {
LoggingMiddleware()
MetricsMiddleware()
if authEnabled {
AuthMiddleware()
}
}
```
Contributor guide
Research direction
Start with the existing prototype in the Middleware module and the server.serve call shown in the issue. Trace how middleware instances are currently assembled, then verify that sequential middleware and the conditional AuthMiddleware example can be expressed through a result builder. Done means the shown syntax works correctly for both unconditional and conditional middleware.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100