diff options
author | lin <lin@debian> | 2023-02-15 00:30:18 +0800 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2023-12-07 15:31:11 +0100 |
commit | 4f26d6a5730685d00ed1533fe33dc2eb3a51a4e8 (patch) | |
tree | 23e6b8126f5fbd0e9e795ec7e3d15c2b7000cbca /test/examples_SUITE.erl | |
parent | 32594a51994c70cfa1a82119a7d439af98c384b4 (diff) | |
download | cowboy-4f26d6a5730685d00ed1533fe33dc2eb3a51a4e8.tar.gz cowboy-4f26d6a5730685d00ed1533fe33dc2eb3a51a4e8.tar.bz2 cowboy-4f26d6a5730685d00ed1533fe33dc2eb3a51a4e8.zip |
Add UTF-8 support to example file_server
LH: I have fixed issues in the PR and incorporated changes
from a sister PR by @djankovic (git author: Dom J). I also
made sure the UTF-8 files were readable without Chinese
fonts and added their downloading to the examples test suite.
Diffstat (limited to 'test/examples_SUITE.erl')
-rw-r--r-- | test/examples_SUITE.erl | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/test/examples_SUITE.erl b/test/examples_SUITE.erl index ed90c2b..1e88f2f 100644 --- a/test/examples_SUITE.erl +++ b/test/examples_SUITE.erl @@ -372,13 +372,16 @@ file_server(Config) -> do_file_server(Transport, Protocol, Config) -> %% Directory. {200, DirHeaders, <<"<!DOCTYPE html><html>", _/bits >>} = do_get(Transport, Protocol, "/", Config), - {_, <<"text/html">>} = lists:keyfind(<<"content-type">>, 1, DirHeaders), + {_, <<"text/html; charset=utf-8">>} = lists:keyfind(<<"content-type">>, 1, DirHeaders), _ = do_rest_get(Transport, Protocol, "/", <<"application/json">>, undefined, Config), %% Files. {200, _, _} = do_get(Transport, Protocol, "/small.mp4", Config), {200, _, _} = do_get(Transport, Protocol, "/small.ogv", Config), {200, _, _} = do_get(Transport, Protocol, "/test.txt", Config), {200, _, _} = do_get(Transport, Protocol, "/video.html", Config), + {200, _, _} = do_get(Transport, Protocol, + ["/", cow_uri:urlencode(<<"中文"/utf8>>), "/", cow_uri:urlencode(<<"中文.html"/utf8>>)], + Config), ok. %% Markdown middleware. |