Add missing required rack environment key #176

Merged
merged 1 commit into from Apr 28, 2012
View
3 lib/webmock/rack_response.rb
@@ -36,7 +36,8 @@ def build_rack_env(request)
'PATH_INFO' => uri.path,
'QUERY_STRING' => uri.query || '',
'SERVER_NAME' => uri.host,
- 'SERVER_PORT' => uri.port
+ 'SERVER_PORT' => uri.port,
+ 'SCRIPT_NAME' => ""
}
env['HTTP_AUTHORIZATION'] = 'Basic ' + [uri.userinfo].pack('m').delete("\r\n") if uri.userinfo
View
2 spec/support/my_rack_app.rb
@@ -27,7 +27,7 @@ def self.call(env)
name = env["rack.input"].read[/name=([^&]*)/, 1] || "World"
[200, {}, ["Good to meet you, #{name}!"]]
when ['GET', '/compute']
- if env['SERVER_PORT'] == 80
+ if env['SERVER_PORT'] == 80 && env["SCRIPT_NAME"] == ""
[200, {}, [""]]
else
[401, {}, [""]]