2013-10-11 61 views

回答

1

我在這裏有點困惑。你在說505狀態碼嗎?還是你在談論提出例外?

我不認爲有一個505例外,所以我假設你說的HTTP狀態代碼版本不支持(http://en.wikipedia.org/wiki/List_of_HTTP_status_codes)。

也可能是這樣簡單:

def index 
    render nothing: true, status: 505 
    end 

如果你打電話一樣,你會得到這樣的東西作爲響應行動:

curl -I http://hamburg.onruby.dev:5000/ 
HTTP/1.1 505 HTTP Version not supported 
X-Frame-Options: SAMEORIGIN 
X-XSS-Protection: 1; mode=block 
X-Content-Type-Options: nosniff 
X-UA-Compatible: chrome=1 
Content-Type: text/html; charset=utf-8 
X-Meta-Request-Version: 0.2.8 
Cache-Control: no-cache 
Set-Cookie: locale=de; domain=onruby.dev; path=/; expires=Sat, 11 Oct 2014 07:45:52 -0000 
X-Request-Id: b8232480-5585-4e99-bc4c-44019e41db6a 
X-Runtime: 0.010615 
Connection: close 
Server: thin 1.5.1 codename Straight Razor