File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,14 @@ def test_echo(env)
4343 [ 200 , { } , EchoWrapper . new ( env [ "rack.input" ] ) ]
4444 end
4545
46+ def test_env ( env )
47+ query = Rack ::Utils . parse_nested_query ( env [ "QUERY_STRING" ] )
48+ key = query [ "key" ]
49+ value = env [ key ]
50+
51+ [ 200 , { } , [ JSON . dump ( value ) ] ]
52+ end
53+
4654 def test_cookies ( env )
4755 cookies = JSON . parse ( env [ "rack.input" ] . read )
4856
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ # Released under the MIT License.
4+ # Copyright, 2022, by Samuel Williams.
5+
6+ require "client_context"
7+ include ClientContext
8+
9+ it "has REQUEST_PATH set correctly" do
10+ response = client . get ( "/env?key=REQUEST_PATH" )
11+ expect ( response . status ) . to be == 200
12+
13+ body = JSON . parse ( response . body . read )
14+ expect ( body ) . to be == "/env?key=REQUEST_PATH"
15+ ensure
16+ response &.finish
17+ end
You can’t perform that action at this time.
0 commit comments