Skip to content
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
8 changes: 8 additions & 0 deletions lib/rack/conform/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ def test_echo(env)
[200, {}, EchoWrapper.new(env["rack.input"])]
end

def test_env(env)
query = Rack::Utils.parse_nested_query(env["QUERY_STRING"])
key = query["key"]
value = env[key]

[200, {}, [JSON.dump(value)]]
end

def test_cookies(env)
cookies = JSON.parse(env["rack.input"].read)

Expand Down
17 changes: 17 additions & 0 deletions test/rack/conform/request.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2022, by Samuel Williams.

require "client_context"
include ClientContext

it "has REQUEST_PATH set correctly" do
response = client.get("/env?key=REQUEST_PATH")
expect(response.status).to be == 200

body = JSON.parse(response.body.read)
expect(body).to be == "/env"
ensure
response&.finish
end
Loading