-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
Description
This code: https://github.com/sinatra/sinatra/blob/v4.0.0/sinatra-contrib/lib/sinatra/cookies.rb
Or give it some love?
Do we need to do this? Isn't Rack doing this?
sinatra/sinatra-contrib/lib/sinatra/cookies.rb
Lines 311 to 332 in b626e2d
| def parse_response | |
| cookies_from_response = Array(@response['Set-Cookie']) | |
| return if @response_array == cookies_from_response | |
| hash = {} | |
| cookies_from_response.each do |line| | |
| key, value = line.split(';', 2).first.to_s.split('=', 2) | |
| next if key.nil? | |
| key = Rack::Utils.unescape(key) | |
| if line =~ /expires=Thu, 01[-\s]Jan[-\s]1970/ | |
| @deleted << key | |
| else | |
| @deleted.delete key | |
| hash[key] = value | |
| end | |
| end | |
| @response_hash.replace hash | |
| @response_array = cookies_from_response | |
| end |