Commit b31185c0727608433bb9242d9eea84f8ee7c8073

Thomas de Grivel 2022-03-13T16:52:52

sign body of request

diff --git a/lib/ex_ovh/request.ex b/lib/ex_ovh/request.ex
index 31d389b..9f4c095 100644
--- a/lib/ex_ovh/request.ex
+++ b/lib/ex_ovh/request.ex
@@ -34,12 +34,6 @@ defmodule ExOvh.Request do
       conn
     end
     conn =
-    unless (:body in Map.get(conn, :completed_transformations, [])) do
-      ExOvh.Transformation.Body.apply(conn, "")
-    else
-      conn
-    end
-    conn =
     unless (:hackney_options in Map.get(conn, :completed_transformations, [])) do
       ExOvh.Transformation.HackneyOptions.apply(conn, client)
     else
diff --git a/lib/ex_ovh/transformation/auth.ex b/lib/ex_ovh/transformation/auth.ex
index d99df4b..3787c97 100644
--- a/lib/ex_ovh/transformation/auth.ex
+++ b/lib/ex_ovh/transformation/auth.ex
@@ -6,11 +6,11 @@ defmodule ExOvh.Transformation.Auth do
   # Public
 
   @spec apply(HTTPipe.Conn.t, atom) :: HTTPipe.Conn.t
-  def apply(%HTTPipe.Conn{request: %HTTPipe.Request{method: method, headers: headers, url: url}} = conn, client) do
+  def apply(%HTTPipe.Conn{request: %HTTPipe.Request{method: method, body: body, headers: headers, url: url}} = conn, client) do
     trans = Map.get(conn, :completed_transformations, [])
     unless (Enum.member?(trans, :url)), do: raise ":url must be added to the transformations before applying the :auth step"
     ovh_config = client.ovh_config()
-    headers = Map.merge(headers, headers([ovh_config[:application_secret], ovh_config[:application_key], ovh_config[:consumer_key], Atom.to_string(method), url, ""], client))
+    headers = Map.merge(headers, headers([ovh_config[:application_secret], ovh_config[:application_key], ovh_config[:consumer_key], Atom.to_string(method), url, body], client))
     request = Map.put(conn.request, :headers, headers)
     Map.put(conn, :request, request)
     |> Map.put(:completed_transformations, trans ++ [:auth])