Content negotiation header

最後更新: 2022-10-27

目錄

  • Accept
  • Accept-Encoding

Accept

 

Client (browser) 用來表示它懂得那些 format (用於 Content negotiation)

Syntax

Accept: <MIME_type>/<MIME_subtype>       # image/png
Accept: <MIME_type>/*                    # image/*
Accept: */*

Content negotiation

for serving different representations of a resource to the same URI
document language(en), image format(png), content encoding(gzip)

 


Accept-Encoding

 

indicates the content encoding (usually a compression algorithm) that the client can understand

Syntax

Accept-Encoding: gzip
Accept-Encoding: compress
Accept-Encoding: deflate
Accept-Encoding: br
Accept-Encoding: identity
Accept-Encoding: *