Skip to content
ADP
API Design PrincipleBETA

[ADP-146] Accept-Post

這是一個僅用於回應的標頭。

原則

  • 可以使用 Accept-Post 告訴客戶端不支持使用請求的 MIME 類型(Content-Type)進行 POST。在這種情況下應(SHOULD)返回 415。

  • 如果客戶端在請求標頭中沒有使用 Content-Type 進行 POST,則不應回應 Accept-Post 或狀態 415。

    http
    POST /resources
    Content-Type: image/jpeg
    
    {
        "name": "example"
    }
    
    HTTP/1.1 415 Unsupported Media Type
    Accept-Post: application/json

    TIP

    💡 LDP 伺服器應該在 OPTIONS 回應中包含 Accept-Post。參見 https://www.w3.org/TR/ldp/;但我們在 API 設計中不涵蓋這一點。

    http
    GET /resources
    
    Accept-Post: application/json, image/jpeg

參考