Permalink
Browse files

Add required rack environment keys

  • Loading branch information...
1 parent 4711a0b commit a2ce124ce68cd34f4961ca8b248d54e36f2fdc2e @oestrich oestrich committed Apr 24, 2012
Showing with 3 additions and 2 deletions.
  1. +2 −1 lib/webmock/rack_response.rb
  2. +1 −1 spec/support/my_rack_app.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
@@ -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, {}, [""]]

0 comments on commit a2ce124

Please sign in to comment.