From 71f841ecb73dbb4a831ab2b0cf05513e8184e448 Mon Sep 17 00:00:00 2001 From: Alex Wied <543423+centromere@users.noreply.github.com> Date: Thu, 14 May 2026 12:36:44 -0400 Subject: [PATCH] feat(header): Add Prefer and Preference-Applied headers See also: https://http.dev/prefer https://http.dev/preference-applied --- src/header/mod.rs | 2 ++ src/header/name.rs | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/header/mod.rs b/src/header/mod.rs index 1a5f1ede..e285b948 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -101,6 +101,8 @@ pub use self::name::{ MAX_FORWARDS, ORIGIN, PRAGMA, + PREFER, + PREFERENCE_APPLIED, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, PUBLIC_KEY_PINS, diff --git a/src/header/name.rs b/src/header/name.rs index 02af57e1..a1de717f 100644 --- a/src/header/name.rs +++ b/src/header/name.rs @@ -737,6 +737,28 @@ standard_headers! { /// Cache-Control HTTP/1.1 header is not yet present. (Pragma, PRAGMA, b"pragma"); + /// Influencing how a server processes a request without changing its + /// semantics is achieved through the Prefer request header, which + /// communicates optional processing preferences. + /// + /// The Prefer header enables clients to express preferences about how a + /// server processes a request and constructs a response. Preferences are + /// advisory. A server is free to ignore any or all preferences without + /// causing the request to fail. When a server honors one or more + /// preferences, the Preference-Applied response header confirms which ones + /// were applied. + (Prefer, PREFER, b"prefer"); + + /// When a server honors optional behaviors from the Prefer request header, + /// the Preference-Applied response header confirms which preferences were + /// applied during processing. + /// + /// The Preference-Applied header is part of the HTTP Prefer framework. + /// Clients use the Prefer request header to request optional behaviors + /// during request processing. The server responds with Preference-Applied + /// to confirm which preferences were applied. + (PreferenceApplied, PREFERENCE_APPLIED, b"preference-applied"); + /// Defines the authentication method that should be used to gain access to /// a proxy. ///