Rails 3 middleware modify request headers

。_饼干妹妹 提交于 2019-12-04 23:22:48

In your call method, you should be able to modify env, which is the Rack Environment. Rack prepends HTTP_ to each header, so the Accept header would be accessed via env['HTTP_ACCEPT'].

So if you need to delete certain headers, you should be able to do something like env.delete('HTTP_ACCEPT'). Then when you do @app.call(env), it will use your modified env.

See the Rack documentation for more information on the env object (see "The Environment").

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!