Rails,您如何以绝对最低的级别访问原始请求数据? [英] Rails, how do you access the raw request data at the absolute lowest level?
问题描述
Rails request
对象在请求生命周期中最早何时可用?本质上,请求什么时候最先作为请求对象可用,在哪个对象中可用? ActionDispatch
?
When is the Rails request
object available at the earliest time during the request lifecycle? Essentially, when is the request first available as a request object, and in which object? ActionDispatch
?
您可以从Tester::Application
访问请求参数吗?如果是这样,怎么办?如果没有,那么如何使用环境?该信息何时设置?
Can you access request parameters from Tester::Application
? If so, how? If not, what about using the environment? When is that information set?
推荐答案
Rack网络服务器创建request
对象,然后ActionDispatch继承该对象.因此,从本质上讲,您将能够访问应用程序中间件中的Rack::Request
或ActionDispatch::Request
对象.
The Rack webserver creates the request
object and then ActionDispatch inherits from it. So essentially, you'd be able to access the Rack::Request
or ActionDispatch::Request
objects within the middleware of the app.
机架::请求
https://github.com/rack/rack/blob/master/lib/rack/request.rb
ActionDispatch ::请求
https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/http/request.rb
这篇关于Rails,您如何以绝对最低的级别访问原始请求数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!