HTTP Fields as Request and Response Metadata

HTTP fields can describe a request's preferences, a representation's properties, or other protocol metadata. Their value rules depend on the individual field.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a preference and a result
  2. Follow field-specific parsing
  3. Locate which field carries each part of the exchange
  4. Check the scope of stored metadata

Trace a preference and a result

A client can express an acceptable media type, while the server declares the response's media type. The fields serve different roles even when they contain an identical type name. Content type describes the received representation.

Follow field-specific parsing

Some field value syntaxes permit lists or parameters and others differ. Parse the intended field according to its defined grammar. Delimiters and escaping explains why splitting arbitrary values can lose structure.[1]

Locate which field carries each part of the exchange

A client can ask for JSON using Accept and send a conditional request using a saved entity tag. The server can reply that the stored representation still matches, letting the client use its cached body. These fields provide constraints separate from the request path. See response caching.

Client saved entity tag "v2"
Request includes If-None-Match: "v2"
Matched conditional retrieval can return 304
Client retains its corresponding stored representation

Check the scope of stored metadata

A cached tag belongs to a particular representation and variant. Forwarding one field without considering the context can misinterpret what was checked. Test a changed representation and a matching stored one.

References

  1. IETF, RFC 9110: HTTP Semantics ↩