|
|
@@ -199,6 +199,7 @@ t_query_params(_Config) ->
|
|
|
mountpoint := <<"MOUNTPOINT">>,
|
|
|
topic := <<"t/1">>,
|
|
|
action := <<"publish">>,
|
|
|
+ access := <<"2">>,
|
|
|
qos := <<"1">>,
|
|
|
retain := <<"false">>
|
|
|
} = cowboy_req:match_qs(
|
|
|
@@ -210,6 +211,7 @@ t_query_params(_Config) ->
|
|
|
mountpoint,
|
|
|
topic,
|
|
|
action,
|
|
|
+ access,
|
|
|
qos,
|
|
|
retain
|
|
|
],
|
|
|
@@ -227,6 +229,7 @@ t_query_params(_Config) ->
|
|
|
"mountpoint=${mountpoint}&"
|
|
|
"topic=${topic}&"
|
|
|
"action=${action}&"
|
|
|
+ "access=${access}&"
|
|
|
"qos=${qos}&"
|
|
|
"retain=${retain}"
|
|
|
>>
|
|
|
@@ -261,6 +264,7 @@ t_path(_Config) ->
|
|
|
"MOUNTPOINT/"
|
|
|
"t%2F1/"
|
|
|
"publish/"
|
|
|
+ "2/"
|
|
|
"1/"
|
|
|
"false"
|
|
|
>>,
|
|
|
@@ -278,6 +282,7 @@ t_path(_Config) ->
|
|
|
"${mountpoint}/"
|
|
|
"${topic}/"
|
|
|
"${action}/"
|
|
|
+ "${access}/"
|
|
|
"${qos}/"
|
|
|
"${retain}"
|
|
|
>>
|
|
|
@@ -318,6 +323,7 @@ t_json_body(_Config) ->
|
|
|
<<"mountpoint">> := <<"MOUNTPOINT">>,
|
|
|
<<"topic">> := <<"t">>,
|
|
|
<<"action">> := <<"publish">>,
|
|
|
+ <<"access">> := <<"2">>,
|
|
|
<<"qos">> := <<"1">>,
|
|
|
<<"retain">> := <<"false">>
|
|
|
},
|
|
|
@@ -335,6 +341,7 @@ t_json_body(_Config) ->
|
|
|
<<"mountpoint">> => <<"${mountpoint}">>,
|
|
|
<<"topic">> => <<"${topic}">>,
|
|
|
<<"action">> => <<"${action}">>,
|
|
|
+ <<"access">> => <<"${access}">>,
|
|
|
<<"qos">> => <<"${qos}">>,
|
|
|
<<"retain">> => <<"${retain}">>
|
|
|
}
|
|
|
@@ -402,7 +409,7 @@ t_placeholder_and_body(_Config) ->
|
|
|
cowboy_req:path(Req0)
|
|
|
),
|
|
|
|
|
|
- {ok, [{PostVars, true}], Req1} = cowboy_req:read_urlencoded_body(Req0),
|
|
|
+ {ok, PostVars, Req1} = cowboy_req:read_urlencoded_body(Req0),
|
|
|
|
|
|
?assertMatch(
|
|
|
#{
|
|
|
@@ -413,10 +420,11 @@ t_placeholder_and_body(_Config) ->
|
|
|
<<"mountpoint">> := <<"MOUNTPOINT">>,
|
|
|
<<"topic">> := <<"t">>,
|
|
|
<<"action">> := <<"publish">>,
|
|
|
+ <<"access">> := <<"2">>,
|
|
|
<<"CN">> := ?PH_CERT_CN_NAME,
|
|
|
<<"CS">> := ?PH_CERT_SUBJECT
|
|
|
},
|
|
|
- emqx_utils_json:decode(PostVars, [return_maps])
|
|
|
+ maps:from_list(PostVars)
|
|
|
),
|
|
|
{ok, ?AUTHZ_HTTP_RESP(allow, Req1), State}
|
|
|
end,
|
|
|
@@ -430,6 +438,7 @@ t_placeholder_and_body(_Config) ->
|
|
|
<<"mountpoint">> => <<"${mountpoint}">>,
|
|
|
<<"topic">> => <<"${topic}">>,
|
|
|
<<"action">> => <<"${action}">>,
|
|
|
+ <<"access">> => <<"${access}">>,
|
|
|
<<"CN">> => ?PH_CERT_CN_NAME,
|
|
|
<<"CS">> => ?PH_CERT_SUBJECT
|
|
|
},
|