1. Introduction

Proactive content negotiation lets one URL serve several representations. The client lists media ranges with optional weights, for example text/markdown, text/html;q=0.9, */*;q=0.1, and the server picks the best offer it can produce. RFC 9110 Section 12 [1] defines the rules. Weights run from 0 to 1 with at most three decimals, q=0 means “not acceptable”, and the most specific matching range sets a type’s weight. Media type and parameter names are case-insensitive, and recipients must tolerate empty list elements. Some documentation sites now offer Markdown to AI agents through Accept negotiation [2], and JSON-or-HTML endpoints are common in agent-built APIs. Few developers write this logic themselves. They call req.accepts(), request.accept_mimetypes.best_match() or a Go helper. We ask: given the same header and the same offers, does each widely used negotiator pick the same representation, and does it respect the RFC where the RFC is unambiguous?

Taghzouti et al. survey content negotiation styles and dimensions [3] but do not test implementations. Rautenstrauch and Stock [4] tested HTTP servers against 106 specification rules. We read their released suite: its Accept-family rules check response-side headers (for example Accept-Patch and Accept-Ranges syntax), not request-side negotiation. HTTP differential fuzzers (T-Reqs, HDiff, HTTP Garden) [5–7] target message framing. CornerCase [13] generates RFC boundary tests with an LLM across five HTTP servers; its reported HTTP findings concern Host headers and null bytes, not negotiation. Individual bug reports exist: Werkzeug tightened q-value parsing in 2.3 [8], Django fixed its preferred-type ordering [9], and a Django REST framework discussion and open pull request concern q=0 in renderer selection [10]. The goautoneg tracker has an open issue that ParseAccept does not enforce q≤1, but none on q=0 [11]. We found no study that runs one shared corpus of Accept headers through negotiators from several ecosystems and reports a per-case matrix.

3. Method

Subjects. Node v24.22.1: accepts 2.0.0 (negotiator 1.1.0), used by Express 5’s req.accepts, and accepts 1.3.8 (negotiator 0.6.3), used by Express 4. CPython 3.13.5: Werkzeug 3.1.9 Request.accept_mimetypes.best_match (Flask), Django 6.1.3 HttpRequest.get_preferred_type, and Falcon 4.4.0 Request.client_prefers. Go 1.27.3: github.com/munnerz/goautoneg Negotiate (commit a7dc8b61; Kubernetes apiserver and prometheus/common import this package, though they call ParseAccept and apply their own selection), github.com/golang/gddo/httputil.NegotiateContentType (20d68f94, repository archived) and github.com/elnormous/contenttype 1.0.4 GetAcceptableMediaType. Each negotiator gets a real request object for its framework (Werkzeug EnvironBuilder, Django HttpRequest, Falcon testing.create_req, Go http.NewRequest). “No choice” is recorded as — (false, None, empty string, the empty default or an error). An absent header is passed as absent, except to goautoneg, which takes a string; there we pass "", as r.Header.Get("Accept") would.

Cases. gen_cases.py writes 68 cases in eight groups: basic, q ordering and ties, q=0 refusals, q-value syntax, wildcards and case, parameters, malformed lists, and real-world headers (Appendix B).

RFC reading. For 45 cases RFC 9110 fixes the acceptable answer set. We list every tied offer as acceptable, use “—” when nothing is acceptable, and also record which offers the header refused with q=0 (expected.json). We gave no reading for the 23 cases with invalid weights, invalid media ranges, an empty header or a type listed twice, because the RFC does not define recovery.

Reproduce.

git clone https://github.com/buildngrowsv/pubroot-pilots && cd pubroot-pilots
git checkout 57b2f03d62f256baca6bbf570cd9fb764ea7ef31
cd accept-qvalue/js && npm ci && cd ..
python3 -m venv .venv && .venv/bin/pip install -r py/requirements.txt
PY=.venv/bin/python ./run_all.sh

Folder: https://github.com/buildngrowsv/pubroot-[REDACTED_SECRET]-qvalue/ (Go modules pinned by go/go.sum).

Two runs in the working tree and a third from a git archive export with fresh installs produced byte-identical results/ files.

4. Results

The negotiators disagreed on 44 of 68 cases (at most three distinct answers per case). Against the 45 RFC readings, they matched: accepts 2 and accepts 1.3 45, Werkzeug 43, Django 42, Falcon 40, contenttype 40, goautoneg 31 and gddo 31. The two accepts versions differed only on q= with an empty value (A24). Pairwise differences ranged from 1 case (accepts 2 versus 1.3) to 35 (goautoneg versus contenttype).

4.1 Refusals ignored (A10–A17). The RFC says the most specific matching range governs a type, so in text/html;q=0, */* HTML is refused and JSON is acceptable. accepts, Werkzeug, Falcon and contenttype chose JSON. Django, gddo and goautoneg chose text/html. Django’s accepted_types filters out every entry with quality 0 before matching, and gddo’s loop skips any spec with Q == 0. In both, the refusal disappears and */* matches HTML. goautoneg’s Negotiate never reads Q: for a lone text/html;q=0 it returned text/html, for */*;q=0 it returned the first offer, and for text/markdown;q=0 it returned text/markdown. Three negotiators therefore serve, in at least one case, the exact representation the client refused.

4.2 Ties (A08, A09). With equal weights the RFC leaves the choice to the server. accepts, Django, goautoneg and contenttype follow header order. Werkzeug, Falcon and gddo follow the server’s offer order. For text/html, application/json with offers [json, html], the first group returns HTML and the second JSON.

4.3 Weight syntax (A20–A35). For weights outside the grammar there were three main strategies. Werkzeug skips the entry (but read an empty q= and a space-padded q = 0.1 as no weight, i.e. q=1). Django promotes any unparsable or out-of-range weight to q=1 (q=-1, q=abc and q=0x1 all made JSON win), and rounds q=0.0001 to 0 (a refusal). Falcon and contenttype treat one bad weight as a broken header and return nothing. contenttype also rejected q=1e-1. gddo returned nothing for negative, non-numeric, empty, leading-dot, quoted and space-padded weights, and its digit-prefix parser read q=1e-1 as 1. Upper-case Q=0.1 is valid, because ABNF literals are case-insensitive. Six negotiators honoured it; goautoneg ignored the weight and gddo returned nothing.

4.4 Wildcards, case and parameters (A36–A48). goautoneg’s sort comparator ranks a concrete type above a wildcard regardless of weight. With text/*, application/json;q=0.5 it chose JSON (q=0.5) over HTML (q=1). Falcon, goautoneg and gddo compare media types case-sensitively and found no match for TEXT/HTML. A plain application/json range should match an offer application/json;charset=utf-8; Werkzeug, goautoneg and gddo returned nothing. goautoneg and gddo also failed both parameterised-offer cases (A44, A48). Falcon and goautoneg accept a bare * as */*.

4.5 Empty and absent headers (A04, A05, A49–A54). With no Accept header, any offer is acceptable. Werkzeug, goautoneg and gddo returned no choice (the caller’s default). The empty header, which the RFC leaves undefined, split 3–5: both accepts versions and Falcon picked the first offer. Empty list elements (application/json, , text/html), which recipients must tolerate, made Falcon and contenttype return nothing. Trailing semicolons and empty parameters, which the RFC 9110 parameter grammar allows, made gddo and contenttype return nothing.

5. Real-world headers

Twelve cases use real default headers: Firefox 132+/Safari, Chrome 131+, legacy Edge and Opera (from MDN’s list of default Accept values [12]), JDK 8 HttpURLConnection (OpenJDK 8 source: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2), axios (application/json, text/plain, */*), and the */* of curl and requests. All eight agreed on the Firefox, Chrome, Opera and plain */* cases. Edge (A61), axios (A65) and the Chrome image header (A68) produce ties; Falcon broke them differently from the other seven. For JDK 8 (A63, A64), whose *; q=.2 and q=.2 are outside the grammar, contenttype rejected the whole header. With only a JSON offer, Werkzeug and gddo also returned no choice, while the other five served JSON.

6. Implications (hypotheses)

Hypothesis: a documentation site that serves Markdown to agents and HTML to browsers will serve Markdown to a client that sent text/markdown;q=0 if it is built on goautoneg’s Negotiate, and HTML to a client that refused HTML but accepted */* if it is built on Django or gddo. Hypothesis: porting an API from Flask to Express can flip tie-breaks, so the same client receives JSON before the port and HTML after. Hypothesis: clients that send a single malformed weight may get a 406 or a default representation from Falcon or contenttype, where other frameworks would simply skip the bad entry. We did not measure deployed sites.

7. Threats to validity

  • Synthetic cases. 56 of 68 headers are ours; they show divergence, not prevalence.
  • Library level. We called each negotiator directly. Real handlers add defaults (for example a 406 page or a fallback type) on top of “no choice”.
  • RFC readings. The 45 readings and refusal sets are our interpretation and are listed in Appendix B. accepts matching all 45 suggests the readings are not unusual, but they are not an oracle.
  • Versions. One version each. gddo is archived, and goautoneg’s last commit is from 2019.
  • Scope. Media types only; Accept-Language and Accept-Encoding are untested.

8. Conclusion

Eight widely used negotiators gave different answers on 44 of 68 Accept headers. Three of them can serve a representation the client refused with q=0. Others differ in tie-breaking, invalid weights, letter case, parameters and empty list elements. Servers that negotiate between HTML, JSON and Markdown should test refusal and tie cases with their own stack. Agents that want a format should state it with the highest weight and avoid relying on q=0 alone to exclude one.

Appendix A–B. Cases and full verdict matrix

Offers are in server order: html = text/html, json = application/json, md = text/markdown, xml = application/xml, vnd = application/vnd.api+json, json;cs = application/json;charset=utf-8. “RFC reading” lists all acceptable answers (“n/a” = no reading). A * marks a choice outside the reading, and a bold choice followed by ! is a type the header refused with q=0. — means no choice.

Unanimous cases (all eight returned the same choice):

#AcceptOffersAll eight
A01application/jsonhtml, jsonjson
A02text/htmlhtml, jsonhtml
A03*/*html, jsonhtml
A06text/html;q=0.5, application/jsonhtml, jsonjson
A07text/html;q=0.5, application/json;q=0.5html, jsonhtml
A13text/*;q=0, text/htmlhtml, jsonhtml
A16application/json;q=0.9, application/json;q=0html, jsonjson
A18application/json;q=1.0, text/html;q=0.9html, jsonjson
A19application/json;q=1.000, text/html;q=0.9html, jsonjson
A27application/json;q=0.001html, jsonjson
A28application/json; q=0.5, text/html; q=0.4html, jsonjson
A32text/html;q=0.9, application/json;q=0.9;q=0.1html, jsonhtml
A37*/*;q=0.5, application/jsonhtml, jsonjson
A40application/*+jsonhtml, vnd—
A47application/vnd.api+json, application/json;q=0.9json, vndvnd
A52applicationjson, html—
A56text/html;q=0.5 , application/json;q=0.4html, jsonhtml
A57Firefox 132+ defaultjson, htmlhtml
A58Firefox 132+ defaultjson, mdjson
A59Chrome 131+ defaultjson, htmlhtml
A60Chrome 131+ defaultjson, mdjson
A62Opera default (MDN)json, xmlxml
A66*/*md, htmlmd
A67text/markdown, text/html;q=0.9, */*;q=0.1html, mdmd

Disagreeing cases:

#AcceptOffersRFC readingaccepts 2accepts 1.3WerkzeugDjangoFalcongoautoneggddocontenttype
A04(absent)html, jsonhtml / jsonhtmlhtml—*htmlhtml—*—*html
A05(empty)html, jsonn/ahtmlhtml——html———
A08application/json;q=0.5, text/html;q=0.5html, jsonhtml / jsonjsonjsonhtmljsonhtmljsonhtmljson
A09text/html, application/jsonjson, htmlhtml / jsonhtmlhtmljsonhtmljsonhtmljsonhtml
A10text/html;q=0html, json——————html!——
A11text/html;q=0, */*html, jsonjsonjsonjsonjsonhtml!jsonhtml!html!json
A12*/*;q=0.1, text/html;q=0html, jsonjsonjsonjsonjsonhtml!jsonhtml!html!json
A14text/html;q=0, text/*html, json————html!—html!html!—
A15*/*;q=0html, json——————html!——
A17text/markdown;q=0md, html——————md!——
A20application/json;q=1.0001, text/html;q=0.9html, jsonn/ajsonjsonhtmljson—jsonjson—
A21application/json;q=1.5, text/html;q=0.9html, jsonn/ajsonjsonhtmljson—jsonjson—
A22application/json;q=-1, text/html;q=0.1html, jsonn/ahtmlhtmlhtmljson—html——
A23application/json;q=abc, text/html;q=0.1html, jsonn/ahtmlhtmlhtmljson—html——
A24application/json;q=, text/html;q=0.1html, jsonn/ajsonhtmljsonjson—json——
A25application/json;q=.5, text/html;q=0.4html, jsonn/ajsonjsonhtmljsonjsonjson——
A26application/json;q=0.0001, text/html;q=0.00001html, jsonn/ajsonjsonjson—jsonjsonjson—
A29application/json;Q=0.1, text/html;q=0.2html, jsonhtmlhtmlhtmlhtmlhtmlhtmljson*—*html
A30application/json;q = 0.1, text/html;q=0.2html, jsonn/ahtmlhtmljsonhtmlhtmlhtml——
A31application/json;q="0.1", text/html;q=0.2html, jsonn/ahtmlhtmlhtmlhtmlhtmlhtml—html
A33application/json;q=0.1, application/json;q=0.9, text/html;q=0.5html, jsonn/ajsonjsonjsonjsonjsonjsonjsonhtml
A34application/json;q=1e-1, text/html;q=0.2html, jsonn/ahtmlhtmlhtmlhtmlhtmlhtmljson—
A35application/json;q=0x1, text/html;q=0.2html, jsonn/ahtmlhtmlhtmljson—html——
A36text/*, application/json;q=0.5json, htmlhtmlhtmlhtmlhtmlhtmlhtmljson*htmlhtml
A38*jsonn/a————jsonjson——
A39*/jsonhtml, jsonn/ajsonjson—jsonjson———
A41TEXT/HTMLjson, htmlhtmlhtmlhtmlhtmlhtml—*—*—*html
A42text/htmljson, TEXT/HTMLTEXT/HTML / htmlTEXT/HTMLTEXT/HTMLTEXT/HTMLTEXT/HTML—*—*—*html
A43text/html;level=1, text/html;q=0.5htmlhtmlhtmlhtmlhtmlhtmlhtmlhtml—*html
A44text/html;level=1;q=0.5, text/htmlhtml;level=1html;level=1html;level=1html;level=1html;level=1html;level=1html;level=1—*—*html;level=1
A45application/json;charset=utf-8jsonn/a————jsonjson——
A46application/jsonjson;csjson;csjson;csjson;cs—*json;csjson;cs—*—*json;cs
A48text/plain;format=flowed;q=0.9, text/plain;q=0.5fixed, flowedflowedflowedflowedflowedflowedflowed—*—*flowed
A49application/json, , text/html;q=0.5html, jsonjsonjsonjsonjsonjson—*jsonjson—*
A50application/json,html, jsonjsonjsonjsonjsonjson—*jsonjson—*
A51,application/jsonhtml, jsonjsonjsonjsonjsonjson—*json—*—*
A53application/json;html, jsonjsonjsonjsonjsonjsonjsonjson—*—*
A54application/json;;q=0.5, text/html;q=0.9html, jsonhtmlhtmlhtmlhtmlhtmlhtmlhtml—*—*
A55application/json garbage, text/html;q=0.5html, jsonn/ahtmlhtmlhtmlhtmlhtmlhtmljson—
A61text/html, application/xhtml+xml, image/jxr, */*json, htmljson / htmlhtmlhtmlhtmlhtmljsonhtmlhtmlhtml
A63text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2json, htmln/ahtmlhtmlhtmlhtmlhtmlhtmlhtml—
A64text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2jsonn/ajsonjson—jsonjsonjson——
A65application/json, text/plain, */*html, jsonhtml / jsonjsonjsonjsonjsonhtmljsonjsonjson
A68image/avif,image/webp,image/apng,image/*,*/*;q=0.8png, webppng / webpwebpwebpwebpwebppngwebpwebpwebp

References

  1. R. Fielding, M. Nottingham, J. Reschke. RFC 9110: HTTP Semantics, Sections 5.6, 12.4–12.5. 2022. https://www.rfc-editor.org/rfc/rfc9110
  2. “Parsing Accept & quality values.” acceptmarkdown.com guide. https://acceptmarkdown.com/guides/accept-parsing
  3. Y. Taghzouti, A. Zimmermann, M. Lefrançois. Content negotiation on the Web: State of the art. arXiv:2204.10097, 2022.
  4. J. Rautenstrauch, B. Stock. Who’s Breaking the Rules? Studying Conformance to the HTTP Specifications and its Security Impact. ACM AsiaCCS 2024. https://doi.org/10.1145/3634737.3637678 (suite: https://doi.org/10.5281/zenodo.21389441)
  5. B. Jabiyev et al. T-Reqs: HTTP Request Smuggling with Differential Fuzzing. ACM CCS 2021.
  6. K. Shen et al. HDiff: A Semi-automatic Framework for Discovering Semantic Gap Attack in HTTP Implementations. IEEE/IFIP DSN 2022.
  7. B. Kallus et al. The HTTP Garden. arXiv:2405.17737, 2024.
  8. pallets/werkzeug pull request #2753, “Fix qvalue parsing” (2.3.7). https://github.com/pallets/werkzeug/pull/2753
  9. django/django pull request #19553, “Fixed #36447 – Only considered quality when selecting preferred media type.” https://github.com/django/django/pull/19553
  10. encode/django-rest-framework discussion #9986 and pull request #9988, “Honor Accept header q-values during renderer selection.” https://github.com/encode/django-rest-framework/pull/9988
  11. munnerz/goautoneg issue #7, “ParseAccept doesn’t ensure qvalue<=1.” https://github.com/munnerz/goautoneg/issues/7
  12. MDN Web Docs. List of default Accept values. https://developer.mozilla.org/en-[REDACTED_SECRET]
  13. R. Singha, K. Qian, S. Saikrishnan, T. Zhao, S. Abbasloo, R. Beckett, S. K. R. Kakarla, T. D. Millstein, G. Varghese. CornerCase: Automated Extremal Testing of Protocol Implementations using LLMs. arXiv:2606.29124, 2026.