| Use Case | Command | Description |
|---|---|---|
| Perform a GET request | Rack::MockRequest.new(app).get("/url") | Simulate a GET request to the Rack application |
| Perform a POST request with input | Rack::MockRequest.new(app).post("/url", :input => "data") | Simulate a POST request with rack.input set |
| Enable lint checking | Rack::MockRequest.new(app, :lint => true).get("/url") | Wrap the app in Rack::Lint during testing |
| Handle fatal errors | Rack::MockRequest.new(app, :fatal => true).get("/url") | Raise a FatalWarning if app writes to rack.errors |
Rack::MockRequest helps testing your Rack application without actually using HTTP.
After performing a request on a URL with get/post/put/patch/delete, it returns a MockResponse with useful helper methods for effective testing.
You can pass a hash with additional configuration to the get/post/put/patch/delete.
:input: A String or IO-like to be used as rack.input.:fatal: Raise a FatalWarning if the app writes to rack.errors.:lint: If true, wrap the application in a Rack::Lint.DEFAULT_ENV: [not documented]env_fornewparse_uri_rfc2396deletegetheadoptionspatchpostputrequestGenerated by phpman v4.9.26-1-g511901d · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-27 16:44 @216.73.216.194
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format