Skip to content

Conversation

@josephsumabat
Copy link

@josephsumabat josephsumabat commented Aug 17, 2023

Before submitting your PR, check that you've:

Recently was trying to write a test which required that I clear cookies and set them again later on in the test.

cookies <- YT.getCookies
YT.clearCookies

<do something with cookies after>....

Unfortunately getRequestCookies only allows you to access the cookies in a RequestBuilder site context since the type of request is RequestBuilder site () -> YesodExample site () thus something like

cookies <- request $ do
  getRequestCookies

unfortunately does not typecheck and you can only access the cookies from within the request builder. This PR adds the utility funciton getCookies which simply enables the first use case allowing cookies to be accessed outside of a request context without resorting to using an IORef

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

Copy link
Contributor

@parsonsmatt parsonsmatt left a comment

Choose a reason for hiding this comment

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

lgtm! do you mind updating the cabal file to make an easy releate?

Thanks!

@josephsumabat josephsumabat force-pushed the add-yesod-test-getCookies-utility branch from ddb7e1a to 67fab78 Compare October 10, 2023 17:58
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