Catalog Language Negotiation Ignores Accept-Language Quality Weights
Level 2 · node · API · Incorrect HTTP Accept-Language quality negotiation
Scenario
An international shipping platform's product catalog API selects Korean, English or Japanese based on Accept-Language. When a browser sends quality values (q) to express preferences, the service chooses the first supported language in header order instead of the most preferred one. Users who prefer English therefore sometimes see the Japanese catalog. Trace the request controller and language negotiation module to find the defect.
Requirements
- Default to Korean when the header is missing or has no supported languages. - Treat a supported language without q as quality 1. - Select the supported language with the highest quality value. - Never select a language explicitly marked q=0. - When qualities tie, prefer the earlier language in the header. - The response locale and catalog heading must match the selected language.
Acceptance criteria
- A missing Accept-Language header returns the default Korean catalog
- An English-only preference returns the English catalog
- Unsupported language preferences fall back to Korean
- The highest q value wins among multiple supported languages
- An explicit q=0 preference is not prioritized over an acceptable language
- Equal quality values preserve the preference order in the header
- The response heading is written in the language named by locale