HTTP Accept Parser
Parse media ranges, parameters, and q weights in Accept without collapsing order or choosing a representation.
Description
Accept lists media ranges and preference weights for representation negotiation.
When to use HTTP Accept Parser
Use this tool to parse media ranges, parameters, and q weights in Accept without collapsing order or choosing a representation.
Prepare the header field value, cookie records or status code requested. Supply field values without a header-name prefix and preserve syntax for the parser to inspect.
How to use HTTP Accept Parser and understand its results
- Prepare the header field value, cookie records or status code requested. Supply field values without a header-name prefix and preserve syntax for the parser to inspect.
- Enter header using the field table and calculation rules, then run the tool.
- Read ranges. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
| Input field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| header | Accept field value. | string; maximum length: 1000000 | Required |
Paste the field value. Split outside quotes/angle brackets, lowercase ranges and parameter names, and unquote/unescape non-q values. Permit */*, concrete type/* and concrete type/subtype; reject */subtype. Each range allows one unquoted q from 0 to 1 with at most three decimal digits. Remove q from returned parameters; preserve other parameter duplicates and source order. Empty comma groups are skipped.3
quality=explicit q or 1; ranges preserve header order Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| ranges | Media ranges with explicit quality values. | list of object; minimum entries: 0; maximum entries: 100000 |
{
"input": {
"header": "text/html, application/json;q=0.8, */*;q=0.1"
},
"output": {
"ranges": [
{
"range": "text/html",
"quality": 1,
"parameters": []
},
{
"range": "application/json",
"quality": 0.8,
"parameters": []
},
{
"range": "*/*",
"quality": 0.1,
"parameters": []
}
]
}
} Limitations and assumptions
No representation is selected and no specificity ranking or media-parameter/extension semantic separation is applied. Quoted q, duplicate q and invalid syntax fail.
Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.
Alternative or Complementary methods
Use HTTP Accept-Language Parser: Parse RFC 4647 basic language ranges and HTTP quality weights while retaining header order. For a complementary task, use HTTP Content-Type Parser: Parse an HTTP media type and its parameters, preserving parameter values and rejecting duplicate names.
Further background: RFC 9110: Accept.
References
-
HTTP Accept Parser — tool.io
-
RFC 9110: Accept — HTTP Working Group
-
HTTP Content-Type Parser — tool.io
Similar or alternative tools
- HTTP Accept-Language Parser
Parse RFC 4647 basic language ranges and HTTP quality weights while retaining header order.
- HTTP Content-Type Parser
Parse an HTTP media type and its parameters, preserving parameter values and rejecting duplicate names.