mirror of
https://github.com/apple/swift-http-structured-headers
synced 2026-11-24 04:37:50 +00:00
109 lines
3.5 KiB
JSON
109 lines
3.5 KiB
JSON
[
|
|
{
|
|
"name": "basic parameterised list",
|
|
"raw": ["abc_123;a=1;b=2; cdef_456, ghi;q=9;r=\"+w\""],
|
|
"header_type": "list",
|
|
"expected": [
|
|
[{"__type": "token", "value": "abc_123"}, {"a": 1, "b": 2, "cdef_456": true}],
|
|
[{"__type": "token", "value": "ghi"}, {"q": 9, "r": "+w"}]
|
|
],
|
|
"canonical": ["abc_123;a=1;b=2;cdef_456, ghi;q=9;r=\"+w\""]
|
|
},
|
|
{
|
|
"name": "single item parameterised list",
|
|
"raw": ["text/html;q=1.0"],
|
|
"header_type": "list",
|
|
"expected": [
|
|
[{"__type": "token", "value": "text/html"}, {"q": 1.0}]
|
|
]
|
|
},
|
|
{
|
|
"name": "missing parameter value parameterised list",
|
|
"raw": ["text/html;a;q=1.0"],
|
|
"header_type": "list",
|
|
"expected": [
|
|
[{"__type": "token", "value": "text/html"}, {"a": true, "q": 1.0}]
|
|
]
|
|
},
|
|
{
|
|
"name": "missing terminal parameter value parameterised list",
|
|
"raw": ["text/html;q=1.0;a"],
|
|
"header_type": "list",
|
|
"expected": [
|
|
[{"__type": "token", "value": "text/html"}, {"q": 1.0, "a": true}]
|
|
]
|
|
},
|
|
{
|
|
"name": "no whitespace parameterised list",
|
|
"raw": ["text/html,text/plain;q=0.5"],
|
|
"header_type": "list",
|
|
"expected": [
|
|
[{"__type": "token", "value": "text/html"}, {}],
|
|
[{"__type": "token", "value": "text/plain"}, {"q": 0.5}]
|
|
],
|
|
"canonical": ["text/html, text/plain;q=0.5"]
|
|
},
|
|
{
|
|
"name": "whitespace before = parameterised list",
|
|
"raw": ["text/html, text/plain;q =0.5"],
|
|
"header_type": "list",
|
|
"must_fail": true
|
|
},
|
|
{
|
|
"name": "whitespace after = parameterised list",
|
|
"raw": ["text/html, text/plain;q= 0.5"],
|
|
"header_type": "list",
|
|
"must_fail": true
|
|
},
|
|
{
|
|
"name": "whitespace before ; parameterised list",
|
|
"raw": ["text/html, text/plain ;q=0.5"],
|
|
"header_type": "list",
|
|
"must_fail": true
|
|
},
|
|
{
|
|
"name": "whitespace after ; parameterised list",
|
|
"raw": ["text/html, text/plain; q=0.5"],
|
|
"header_type": "list",
|
|
"expected": [
|
|
[{"__type": "token", "value": "text/html"}, {}],
|
|
[{"__type": "token", "value": "text/plain"}, {"q": 0.5}]
|
|
],
|
|
"canonical": ["text/html, text/plain;q=0.5"]
|
|
},
|
|
{
|
|
"name": "extra whitespace parameterised list",
|
|
"raw": ["text/html , text/plain; q=0.5; charset=utf-8"],
|
|
"header_type": "list",
|
|
"expected": [
|
|
[{"__type": "token", "value": "text/html"}, {}],
|
|
[{"__type": "token", "value": "text/plain"},
|
|
{"q": 0.5, "charset": {"__type": "token", "value": "utf-8"}
|
|
}]
|
|
],
|
|
"canonical": ["text/html, text/plain;q=0.5;charset=utf-8"]
|
|
},
|
|
{
|
|
"name": "two lines parameterised list",
|
|
"raw": ["text/html", "text/plain;q=0.5"],
|
|
"header_type": "list",
|
|
"expected": [
|
|
[{"__type": "token", "value": "text/html"}, {}],
|
|
[{"__type": "token", "value": "text/plain"}, {"q": 0.5}]
|
|
],
|
|
"canonical": ["text/html, text/plain;q=0.5"]
|
|
},
|
|
{
|
|
"name": "trailing comma parameterised list",
|
|
"raw": ["text/html,text/plain;q=0.5,"],
|
|
"header_type": "list",
|
|
"must_fail": true
|
|
},
|
|
{
|
|
"name": "empty item parameterised list",
|
|
"raw": ["text/html,,text/plain;q=0.5,"],
|
|
"header_type": "list",
|
|
"must_fail": true
|
|
}
|
|
]
|