diff --git a/bridgetown-core/lib/roda/plugins/bridgetown_server.rb b/bridgetown-core/lib/roda/plugins/bridgetown_server.rb index 15e08df4a..d4edbdda0 100644 --- a/bridgetown-core/lib/roda/plugins/bridgetown_server.rb +++ b/bridgetown-core/lib/roda/plugins/bridgetown_server.rb @@ -136,6 +136,12 @@ def initialize_bridgetown_root # rubocop:todo Metrics/AbcSize "

ERROR: cannot find index.html in the output folder.

" end end + + # This is useful if you're passing the Roda app instance around and want to + # get at `request` / `response` easily as local variables + def deconstruct_keys(*) + { request:, response: } + end end Roda::RodaRequest.alias_method :_previous_roda_cookies, :cookies diff --git a/bridgetown-core/test/ssr/src/_components/UseRoda.rb b/bridgetown-core/test/ssr/src/_components/UseRoda.rb index 14dd7fb84..9c90b1df7 100644 --- a/bridgetown-core/test/ssr/src/_components/UseRoda.rb +++ b/bridgetown-core/test/ssr/src/_components/UseRoda.rb @@ -12,10 +12,10 @@ def template end def call(app) - app.request => r - @testing = r.env["rack.test"] + app => { request:, response: } + @testing = request.env["rack.test"] - app.response["Content-Type"] = "application/rss+xml" + response["Content-Type"] = "application/rss+xml" render_in(app) end