diff options
author | Loïc Hoguin <[email protected]> | 2018-11-02 12:36:51 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-11-02 13:49:54 +0100 |
commit | 399b6a16b4a571e293437dcc8f85808f83b32ff6 (patch) | |
tree | 5b1d5b0e06b1f3bf08f1a858770ff00fe3c2fe3f /test/handlers/charset_in_content_types_provided_implicit_no_callback_h.erl | |
parent | d4dff2105500d960479d278981f42d42beb54175 (diff) | |
download | cowboy-399b6a16b4a571e293437dcc8f85808f83b32ff6.tar.gz cowboy-399b6a16b4a571e293437dcc8f85808f83b32ff6.tar.bz2 cowboy-399b6a16b4a571e293437dcc8f85808f83b32ff6.zip |
Better handle content negotiation when accept contains charsets
Thanks to Philip Witty for help figuring this out.
Diffstat (limited to 'test/handlers/charset_in_content_types_provided_implicit_no_callback_h.erl')
-rw-r--r-- | test/handlers/charset_in_content_types_provided_implicit_no_callback_h.erl | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/handlers/charset_in_content_types_provided_implicit_no_callback_h.erl b/test/handlers/charset_in_content_types_provided_implicit_no_callback_h.erl new file mode 100644 index 0000000..ae17af3 --- /dev/null +++ b/test/handlers/charset_in_content_types_provided_implicit_no_callback_h.erl @@ -0,0 +1,21 @@ +%% This module has a media type provided with a wildcard +%% and lacks a charsets_provided callback. + +-module(charset_in_content_types_provided_implicit_no_callback_h). + +-export([init/2]). +-export([content_types_provided/2]). +-export([get_text_plain/2]). + +init(Req, Opts) -> + {cowboy_rest, Req, Opts}. + +content_types_provided(Req, State) -> + {[ + {{<<"text">>, <<"plain">>, '*'}, get_text_plain} + ], Req, State}. + +get_text_plain(Req, State) -> + {<<"This is REST!">>, Req, State}. + + |