aboutsummaryrefslogtreecommitdiffstats
path: root/test/handlers/content_types_accepted_h.erl
blob: 7aec1bbd12924dd9c005f4e439b06729edfba955 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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}.