8000 Add context to prepareRoutes by jack-davies · Pull Request #121 · aesiniath/unbeliever · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add context to prepareRoutes #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 11, 2022
Merged

Conversation

jack-davies
Copy link
Contributor

Implement prepareRoutesWithContext to align with servant's serveWithContext. Required for servant-auth.

import Core.Webserver.Warp
import Data.Proxy (Proxy)
import GHC.Base (Type)
import Network.Wai (Application)
import Servant (Handler (..), ServerT)
import Servant.Server (HasServer, hoistServer, serve)
import Core.Telemetry.Observability (clearMetrics)
import Servant.Server (Context (..), HasServer, ServerContext, serveWithContextT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point should we make this a qualified import (Servant. presumably), mirroring the pattern elsewhere in this family of libraries? [rather than having to be explicit about Core.Program.Context.Context below]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepareRoutes proxy (routes :: ServerT api (Program τ)) =
prepareRoutes proxy = prepareRoutesWithContext proxy EmptyContext

prepareRoutesWithContext ::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want this part of the public API we should add a Haddock documentation, even if it just has

{-| 
Prepare routes as above, but providing a Context.

@since 0.1.1
-}

in it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I can do these things if you're busy)

@jack-davies
Copy link
Contributor Author

These changes look sensible. I think this is good to go @istathar!

8095

@istathar istathar merged commit 960f75f into aesiniath:main May 11, 2022
@jack-davies jack-davies deleted the servant-auth branch May 11, 2022 03:15
@istathar istathar changed the title Add context to prepareRoutes for servant-auth Add context to prepareRoutes Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0