Skip to content

Commit 2a6d458

Browse files
authored
[rails] Route rack response for plaintext (#9041)
Rails allows short circuiting responses in the router.
1 parent 6affc59 commit 2a6d458

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

frameworks/Ruby/rails/app/controllers/plaintext_controller.rb

Lines changed: 0 additions & 9 deletions
This file was deleted.

frameworks/Ruby/rails/config/routes.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
get "queries", to: "hello_world#query"
77
get "fortunes", to: "hello_world#fortune"
88
get "updates", to: "hello_world#update"
9-
get "plaintext", to: PlaintextController.action(:index)
9+
get "plaintext", to: ->(env) do
10+
[200,
11+
{
12+
'Content-Type' => 'text/plain',
13+
'Date' => Time.now.httpdate,
14+
'Server' => 'Rails'
15+
},
16+
['Hello, World!']]
17+
end
1018
get "cached", to: "hello_world#cached_query"
1119
end

0 commit comments

Comments
 (0)