apple / apple/swift-http-api-proposal
MiddlewareServer only invokes the last middleware, but never propagates the request to the previous ones
- Dominant language
- Swift
- Stars
- 66
- Forks
- 21
- Avg merge
- 7h 39m
- Merged PRs (30d)
- 2
Description
MiddlewareServer only invokes the last middleware, but never propagates the request to the previous ones.
https://github.com/apple/swift-http-api-proposal/blob/d7527be34e41fcae2938cdbdd40368e77a22a5fa/Examples/MiddlewareServer/MiddlewareServer.swift#L35
```swift
try await ExampleMiddlewareServer(
server: server
) { server in
server
.logging(logger: Logger(label: "Logger"))
.requestHandler()
}.serve()
```
The `.logging(...)` middleware is never invoked.
Contributor guide
Research direction
Open Examples/MiddlewareServer/MiddlewareServer.swift at the linked line and trace how the chained logging and requestHandler middleware are invoked. Reproduce the example request and verify that the logging middleware runs before the request handler; the issue is done when the request propagates through both middleware components.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100