使用Rack中间件在每个请求上添加api_key
|
我使用Devise token_authentication服务和ActiveResource客户端。我希望在每个请求中自动设置:auth_token参数!
我试过了,但这行不通...
class AuthApp
def initialize(app)
@app = app
end
def call(env)
status, headers, response = @app.call(env)
request = Rack::Request.new(env)
request.params[:auth_token] = \'jCxKPj8wJJdOnQJB8ERy\'
[status, headers, response]
end
end
任何想法 ?
没有找到相关结果
已邀请:
1 个回复
扑北爱
:
这将持续存在于中间件之间(并传递给Rails)中的“ 3”中。