Commit 02ace2da825c73b29be1ff1a915e92868280b0ab

Stephen Moloney 2016-02-19T13:44:47

add :head method to guards

diff --git a/lib/hubic/hubic_api/auth.ex b/lib/hubic/hubic_api/auth.ex
index 9ca8886..2623160 100644
--- a/lib/hubic/hubic_api/auth.ex
+++ b/lib/hubic/hubic_api/auth.ex
@@ -15,7 +15,7 @@ defmodule ExOvh.Hubic.HubicApi.Auth do
                     :: ExOvh.Client.query_t
   def prepare_request(client, query)
 
-  def prepare_request(client, {method, uri, params} = query) when method in [:get, :delete] do
+  def prepare_request(client, {method, uri, params} = query) when method in [:get, :head, :delete] do
     config = config(client)
     uri = uri(config, uri)
     if params !== :nil and params !== "" and is_map(params), do: uri = uri <> "?" <> URI.encode_query(params)
@@ -78,7 +78,7 @@ defmodule ExOvh.Hubic.HubicApi.Auth do
   defp headers(client, method) when method in [:post, :put] do
     Map.merge(default_headers(client), %{ "Content-Type": "application/json;charset=utf-8" })
   end
-  defp headers(client, method) when method in [:get, :delete], do: default_headers(client)
+  defp headers(client, method) when method in [:get, :head, :delete], do: default_headers(client)
 
   defp config(), do: Cache.get_config(ExOvh)
   defp config(client), do: Cache.get_config(client)
diff --git a/lib/hubic/openstack_api/auth.ex b/lib/hubic/openstack_api/auth.ex
index c2dbd3e..52f677d 100644
--- a/lib/hubic/openstack_api/auth.ex
+++ b/lib/hubic/openstack_api/auth.ex
@@ -15,7 +15,7 @@ defmodule ExOvh.Hubic.OpenstackApi.Auth do
                      :: ExOvh.Client.query_t
   def prepare_request(client, query)
 
-  def prepare_request(client, {method, uri, params} = query) when method in [:get, :delete] do
+  def prepare_request(client, {method, uri, params} = query) when method in [:get, :head, :delete] do
     uri =  Cache.get_endpoint(client) <> uri
     if params !== :nil and params !== "", do: uri = uri <> "?" <> URI.encode_query(params)
     options = %{ headers: headers(client), timeout: @timeout }
diff --git a/lib/ovh/openstack_api/webstorage/auth.ex b/lib/ovh/openstack_api/webstorage/auth.ex
index 6e432ef..fa2cfa5 100644
--- a/lib/ovh/openstack_api/webstorage/auth.ex
+++ b/lib/ovh/openstack_api/webstorage/auth.ex
@@ -15,7 +15,7 @@ defmodule ExOvh.Ovh.OpenstackApi.Webstorage.Auth do
                      :: ExOvh.Client.query_t
   def prepare_request(client, query)
 
-  def prepare_request(client, {method, uri, params} = query, service) when method in [:get, :delete] do
+  def prepare_request(client, {method, uri, params} = query, service) when method in [:get, :head, :delete] do
     uri =  WebStorageCache.get_swift_endpoint(client, service) <> uri
     if params !== :nil and params !== "", do: uri = uri <> "?" <> URI.encode_query(params)
     options = %{ headers: headers(client, service), timeout: @timeout }
diff --git a/lib/ovh/ovh_api/auth.ex b/lib/ovh/ovh_api/auth.ex
index d282e13..f88db27 100644
--- a/lib/ovh/ovh_api/auth.ex
+++ b/lib/ovh/ovh_api/auth.ex
@@ -21,7 +21,7 @@ defmodule ExOvh.Ovh.OvhApi.Auth do
                      :: ExOvh.Client.query_t
   def prepare_request(client, query)
 
-  def prepare_request(client, {method, uri, params} = query) when method in [:get, :delete] do
+  def prepare_request(client, {method, uri, params} = query) when method in [:get, :head, :delete] do
     uri = uri(config, uri)
     config = config(client)
     if params !== :nil and params !== "" and is_map(params), do: uri = uri <> "?" <> URI.encode_query(params)