2
我試圖在新的Rails 3應用程序中使用AB進行性能記錄/跟蹤。 由於應用程序總是需要登錄,我不得不做POST請求登錄。 我能夠將憑證放在一些文本文件中,如下所示,但AuthenticityToken提供了該問題。Rails3的ApacheBenchmark ab問題authenticity_token
#login_data.txt
user_account%5Busername%5D=admin&user_account%5Bpassword%5D=adminhr
#AB command
ab -v4 -n100 -t5 -T 'application/x-www-form-urlencoded' -p login_data.txt http://nhc.lvh.me:3000/
#The log
Started POST "/" for 127.0.0.1 at 2011-02-15 11:13:37 +0545
Processing by CompaniesController#index as */*
Parameters: {"user_account"=>{"username"=>"admin", "password"=>"[FILTERED]"}}
Completed in 1ms
ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
Rendered /Users/millisami/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
Rendered /Users/millisami/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1194.0ms)
Rendered /Users/millisami/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (1291.3ms)
的問題是如何通過或忽略AuthenticityToken使用ab
時? 由於它是動態生成的,我可以存儲在某個地方還是有其他更好的解決方案?