Skip to content
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

feat: Add drop_cookie helper #169

Merged
merged 3 commits into from Nov 8, 2021
Merged

Conversation

shawn-mcginty
Copy link
Contributor

Fixes #144

I tried also building the docs but that seemed to fail for me, but I did add Dream.drop_cookie to the cookie example.


let set_cookie = match path with
| Some p -> set_cookie ~path:p
| None -> set_cookie ~path:(Some (prefix request)) in
Copy link
Owner

@aantron aantron Nov 8, 2021

Choose a reason for hiding this comment

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

Most of the arguments can be simply forwarded to set_cookie, e.g.

set_cookie (* ... *) ?path (* ... *)

The ?secure syntax forwards an optional argument to an optional argument, so you don't have to pattern match on them and then build up a set_cookie closure gradually, as here.

I'll take care of tweaking this after merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wow thanks, I was looking for a feature like this but I could not find it anywhere.

@aantron aantron merged commit 237acbb into aantron:master Nov 8, 2021
@aantron
Copy link
Owner

aantron commented Nov 8, 2021

Thanks!

@aantron aantron mentioned this pull request Nov 8, 2021
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.

Add drop_cookie helper
2 participants