From 354a98ca755357027a5a0e9adfd518af51325106 Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Sun, 16 Jun 2024 11:29:54 +0100 Subject: [PATCH] Allow atoms-as-keys (input) while respecting the remote system It's probably better to spec with atoms, since the keys will be known, but the system appears to not work if we send in atoms, so we convert these to binaries before going to Hex.pm --- src/hex_api_release.erl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/hex_api_release.erl b/src/hex_api_release.erl index d60b24f..763a085 100644 --- a/src/hex_api_release.erl +++ b/src/hex_api_release.erl @@ -143,10 +143,18 @@ delete(Config, Name, Version) when is_map(Config) and is_binary(Name) and is_bin %% ''' %% @end -spec retire(hex_core:config(), binary(), binary(), retirement_params()) -> hex_api:response(). -retire(Config, Name, Version, Params) when +retire(Config, Name, Version, Params0) when is_map(Config) and is_binary(Name) and is_binary(Version) -> Path = hex_api:build_repository_path(Config, ["packages", Name, "releases", Version, "retire"]), + Params = maps:fold( + fun (K, V, AccIn) -> + AccIn#{ + atom_to_binary(K) => V + } + end, + #{}, + Params0), hex_api:post(Config, Path, Params). %% @doc