fix(test): prefer `emqx_connector_http:join_paths/2` in api tests

It is more consistent with what HTTP servers are expecting, plus
not OS-specific as `filename:join/2`.
This commit is contained in:
Andrew Mayorov 2023-05-19 15:37:01 +03:00
parent e4701a71da
commit c440cd77b0
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
1 changed files with 7 additions and 2 deletions

View File

@ -146,10 +146,15 @@ build_http_header(X) ->
[X].
api_path(Parts) ->
?SERVER ++ filename:join([?BASE_PATH | Parts]).
join_http_path([?SERVER, ?BASE_PATH | Parts]).
api_path_without_base_path(Parts) ->
?SERVER ++ filename:join([Parts]).
join_http_path([?SERVER | Parts]).
join_http_path([]) ->
[];
join_http_path([Part | Rest]) ->
lists:foldl(fun(P, Acc) -> emqx_connector_http:join_paths(Acc, P) end, Part, Rest).
%% Usage:
%% upload_request(<<"site.com/api/upload">>, <<"path/to/file.png">>,