按照HTTP1.1 spec,一個接受以下如何解釋HTTP Accept頭文件?
Accept: text/plain; q=0.5, text/html, text/x-dvi; q=0.8, text/x-c
的頭部被解釋爲
text/html and text/x-c are the preferred media types, but if they do not
exist, then send the text/x-dvi entity, and if that does not exist, send
the text/plain entity
讓我們頭更改爲:
Accept: text/html, text/x-c
如果沒有什麼返回這是被接受的?例如讓我們假裝我只支持應用程序/ json
406在這種情況下是正確的。 415適用於客戶端使用應用程序無法處理的Content-Type提交數據(例如,通過POST)的情況。 – 8jean 2009-04-23 18:57:48