From 4fedb336311604253153eafe81f33a77b44a0b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 14 Nov 2018 18:03:40 +0100 Subject: Ignore the boundary parameter when accepting multipart --- test/handlers/content_types_accepted_h.erl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/handlers/content_types_accepted_h.erl (limited to 'test/handlers') diff --git a/test/handlers/content_types_accepted_h.erl b/test/handlers/content_types_accepted_h.erl new file mode 100644 index 0000000..7aec1bb --- /dev/null +++ b/test/handlers/content_types_accepted_h.erl @@ -0,0 +1,23 @@ +%% This module accepts a multipart media type with parameters +%% that do not include boundary. + +-module(content_types_accepted_h). + +-export([init/2]). +-export([allowed_methods/2]). +-export([content_types_accepted/2]). +-export([put_multipart_mixed/2]). + +init(Req, Opts) -> + {cowboy_rest, Req, Opts}. + +allowed_methods(Req, State) -> + {[<<"PUT">>], Req, State}. + +content_types_accepted(Req=#{qs := <<"multipart">>}, State) -> + {[ + {{<<"multipart">>, <<"mixed">>, [{<<"v">>, <<"1">>}]}, put_multipart_mixed} + ], Req, State}. + +put_multipart_mixed(Req, State) -> + {true, Req, State}. -- cgit v1.2.3