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

fix: Unexpected default rack.session #1093

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions lib/webmock/rack_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,12 @@ def build_rack_env(request)
end
env['rack.url_scheme'] = uri.scheme
env['rack.run_once'] = true
env['rack.session'] = session
env['rack.session.options'] = session_options

headers.each do |k, v|
env["HTTP_#{k.tr('-','_').upcase}"] = v
end

env
end

def session
@session ||= {}
end

def session_options
@session_options ||= {}
end
end
end
11 changes: 11 additions & 0 deletions spec/unit/rack_response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@
end
end

it "shouldn't set a rack.session" do
request = WebMock::RequestSignature.new(:get, 'www.example.com/env')
response = @rack_response.evaluate(request)

expect(response.status.first).to eq(200)
body = JSON.parse(response.body)

expect(body).not_to include("rack.session")
expect(body).not_to include("rack.session.options")
end

describe 'rack error output' do
before :each do
@original_stderr = $stderr
Expand Down
Loading