Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler authored Oct 28, 2024
1 parent 60e64ef commit 5694131
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ try await app.runService()

## RequestContext

It is a common requirement that the router `RequestContext` is needed in OpenAPI endpoints. You can do this by adding a middleware that stores the RequestContext in a TaskLocal.
It is a common requirement that the router `RequestContext` is used in OpenAPI endpoints. You can do this by adding a middleware that stores your RequestContext type in a TaskLocal.

```swift
struct RequestContextMiddleware: RouterMiddleware {
Expand All @@ -36,7 +36,7 @@ struct RequestContextMiddleware: RouterMiddleware {
}
```

If you add a version of this middleware, replacing `MyRequestContext` with your own `RequestContext`, to the end of your router middleware chain then the request context is available via `RequestContextMiddleware.requestContext`.
If you add a version of this middleware, replacing `MyRequestContext` with your own `RequestContext` type, to the end of your router middleware chain then it will be available from your OpenAPI endpoints via `RequestContextMiddleware.requestContext`.

## Documentation

Expand Down

0 comments on commit 5694131

Please sign in to comment.