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

Parameterize `CSRF` middleware #1909

Merged
merged 5 commits into from Jun 4, 2018

Conversation

Projects
None yet
2 participants
@tomwadeson
Contributor

tomwadeson commented Jun 1, 2018

Relates to: #1890

@tomwadeson

This comment has been minimized.

Contributor

tomwadeson commented Jun 1, 2018

An issue that I'm about to bump into is bringing the tests (and examples?) inline with this new generalised API.

To get the types to align, due to HttpRoutes, I'm going to have to instantiate a CSRF with:

  val csrf = CSRF.withGeneratedKey[OptionT[IO, ?], IO](clock = testClock).value.unsafeRunSync().get

... which is fairly disgusting (and I think will need to be repeated several times through the test).

Any suggestions for things I can do to mitigate this in the implementation?

@tomwadeson tomwadeson force-pushed the tomwadeson:parameterize-csrf-middleware branch from fcfbeda to 5d4d760 Jun 1, 2018

@rossabaker

This comment has been minimized.

Member

rossabaker commented Jun 3, 2018

Instead of HttpRoutes, can you just use HttpApp? (You can pass a total function to HttpApp.apply, or call .orNotFound on an HttpRoutes).

tomwadeson added some commits Jun 3, 2018

@tomwadeson tomwadeson changed the title from [WIP] Parameterize `CSRF` middleware to [Parameterize `CSRF` middleware Jun 3, 2018

@tomwadeson tomwadeson changed the title from [Parameterize `CSRF` middleware to Parameterize `CSRF` middleware Jun 3, 2018

@rossabaker rossabaker merged commit ce2e2da into http4s:master Jun 4, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment