How to set request headers in rspec request spec?

前端 未结 10 1250
独厮守ぢ
独厮守ぢ 2020-12-04 08:33

In the controller spec, I can set http accept header like this:

request.accept = \"application/json\"

but in the request spec, \"request\"

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-04 09:09

    I used this in Test::Unit:

    @request.env['HTTP_ACCEPT'] = "*/*, application/youtube-client"
    get :index
    

提交回复
热议问题