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

Add method to get request cookies #22

Merged
merged 3 commits into from
Jul 30, 2019
Merged

Add method to get request cookies #22

merged 3 commits into from
Jul 30, 2019

Conversation

waiting-for-dev
Copy link
Owner

@waiting-for-dev waiting-for-dev commented Jul 30, 2019

Conn#request_cookies return cookies request header.

Wrapper around Rack::Session middlewares.

This extension provides with helper methods to retrieve rack
session and work with it while still being able to chain `Conn`
method calls.

It requires one of `Rack::Session` middlewares to be present.

```ruby
require 'web_pipe'

WebPipe.load_extensions(:session)

class MyApp
  include WebPipe

  use Rack::Cookie, secret: 'top_secret'

  plug :put_session, ->(conn) { conn.put_session('foo', 'bar') }
  plug :fetch_session, ->(conn) { conn.put(:foo, conn.fetch_session('foo')) }
  plug :delete_session, ->(conn) { conn.delete_session('foo') }
  plug :clear_session, ->(conn) { conn.clear_session }
end
```
@waiting-for-dev waiting-for-dev added the enhancement New feature or request label Jul 30, 2019
@waiting-for-dev waiting-for-dev changed the title Conn cookie Add method to get request cookies Jul 30, 2019
@waiting-for-dev waiting-for-dev merged commit 24b978d into master Jul 30, 2019
@waiting-for-dev waiting-for-dev deleted the conn_cookie branch July 30, 2019 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant