get '/test' do
session[:my_session_id] = generate_random_id()
puts 'begin haml debug'
haml :"static/haml_page", :locals=>{:session_id => session[:my_session_id]}
end
我在日誌中,上述頁面被不斷呼籲兩次看到:西納特拉HAML頁面調用兩次
begin haml debug
127.0.0.1 - - [02/Nov/2012 00:00:01] "GET/HTTP/1.1" 200 4317 1.5421
127.0.0.1 - - [02/Nov/2012 00:00:01] "GET /js/base/jquery.pjax.002902.js HTTP/1.1" 304 - 0.0234
[2012-11-02 00:00:01] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
127.0.0.1 - - [02/Nov/2012 00:00:01] "GET /css/docs.002902.css HTTP/1.1" 200 165 0.1086
.................................
begin haml debug
127.0.0.1 - - [02/Nov/2012 00:00:04] "GET/HTTP/1.1" 200 4317 1.9288
這讓我有一些問題。這是爲什麼發生?
當您嘗試使用不同的瀏覽器或可能捲曲時,會發生嗎?例如'curl http:// localhost:9292' – iain
不,它不! Chrome要求兩次。爲什麼? –
你的路線說'get'/ test'',但你的日誌說'GET /'。你是否從真實的東西中改變了這個例子? – matt