Accepts "*" as valid media type (interpreted as */* to be flexible)
This commit is contained in:
@@ -97,9 +97,16 @@ feature {NONE} -- Initialization
|
|||||||
-- Extract type and subtype
|
-- Extract type and subtype
|
||||||
p := t.index_of ('/', 1)
|
p := t.index_of ('/', 1)
|
||||||
if p = 0 then
|
if p = 0 then
|
||||||
has_error := True
|
t.right_adjust
|
||||||
type := t
|
type := t
|
||||||
subtype := ""
|
if t.same_string ("*") then
|
||||||
|
-- Flexible parser allowing "*" even if this is not really a valid media-type
|
||||||
|
-- let's interpret it as "*/*"
|
||||||
|
subtype := "*"
|
||||||
|
else
|
||||||
|
has_error := True
|
||||||
|
subtype := "*"
|
||||||
|
end
|
||||||
else
|
else
|
||||||
subtype := t.substring (p + 1, t.count)
|
subtype := t.substring (p + 1, t.count)
|
||||||
type := t
|
type := t
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ feature -- Content type
|
|||||||
test_content_type_with_params ("text/plain; param1=%"something;foo=bar%"; param2=%"another-thing%"",
|
test_content_type_with_params ("text/plain; param1=%"something;foo=bar%"; param2=%"another-thing%"",
|
||||||
"text", "plain", <<["param1", "something;foo=bar"], ["param2", "another-thing"]>>
|
"text", "plain", <<["param1", "something;foo=bar"], ["param2", "another-thing"]>>
|
||||||
)
|
)
|
||||||
|
test_content_type ("*", "*", "*")
|
||||||
|
test_content_type_with_params ("* ; q=0.8", "*", "*", <<["q", "0.8"]>>)
|
||||||
|
test_content_type ("*/*", "*", "*")
|
||||||
|
test_content_type ("text/*", "text", "*")
|
||||||
end
|
end
|
||||||
|
|
||||||
test_http_content_type
|
test_http_content_type
|
||||||
|
|||||||
Reference in New Issue
Block a user