1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
def f() =
content_type =
http.headers.content_type(
[
(
"Content-Type",
"text/html; charset=utf-8"
)
]
)
test.equal(content_type, {mime="text/html", args=[("charset", "utf-8")]})
content_type =
http.headers.content_type(
[
(
"coNtent-tYpe",
"multipart/form-data; boundary=something"
)
]
)
test.equal(
content_type, {mime="multipart/form-data", args=[("boundary", "something")]}
)
extname =
http.headers.extname(
[
(
"Content-Disposition",
'attachment; filename="filename.jpg"'
)
]
)
test.equal(extname, ".jpg")
extname =
http.headers.extname(
[
("Content-type", "audio/mpeg"),
(
"Content-Disposition",
'attachment; filename="filename.jpg"'
)
]
)
test.equal(extname, ".jpg")
settings.http.mime.extnames := [("foo", ".bla")]
extname = http.headers.extname([("conTent-tyPe", "foo")])
test.equal(extname, ".bla")
test.pass()
end
test.check(f)
|