apple / apple/swift-http-api-proposal

MiddlewareServer only invokes the last middleware, but never propagates the request to the previous ones

Open Beginner friendly
#185 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.