diff options
author | Michael Alekseev <justmichael@mail.ru> | 2015-10-05 21:10:37 +0600 |
---|---|---|
committer | Michael Alekseev <justmichael@mail.ru> | 2015-10-05 21:10:37 +0600 |
commit | b86a7c8ed256a4e62799d284982cc8b68a573381 (patch) | |
tree | c7f2e8a721759dd8ed1746269baf2465364a926c | |
parent | bf91eadbcaf8a31b79ebe618e5d4a599d4af5f37 (diff) | |
download | recaptcha-b86a7c8ed256a4e62799d284982cc8b68a573381.tar.gz recaptcha-b86a7c8ed256a4e62799d284982cc8b68a573381.tar.xz |
moved from httpotion to httpoison
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | lib/recaptcha.ex | 9 | ||||
-rw-r--r-- | mix.exs | 7 | ||||
-rw-r--r-- | mix.lock | 10 |
4 files changed, 16 insertions, 13 deletions
@@ -12,8 +12,7 @@ A simple Elixir package for implementing [reCAPTCHA] in [Phoenix] applications. ```elixir defp deps do [ - {:recaptcha, "~> 1.0.0"}, - {:ibrowse, github: "cmullaparthi/ibrowse", tag: "v4.1.2"} + {:recaptcha, "~> 1.1.0"}, ] end ``` diff --git a/lib/recaptcha.ex b/lib/recaptcha.ex index 7ff1eb8..e0656c3 100644 --- a/lib/recaptcha.ex +++ b/lib/recaptcha.ex @@ -49,13 +49,14 @@ defmodule Recaptcha do defp api_response(remote_ip, response, options) do private_key = options[:private_key] || config.private_key - timeout = options[:timeout] || 3000 + timeout = options[:timeout] || 5000 body_content = URI.encode_query(%{"remoteip" => to_string(remote_ip), "response" => response, "secret" => private_key}) - headers = ["Content-type": "application/x-www-form-urlencoded"] - options = [body: body_content, headers: headers, timeout: timeout] - HTTPotion.post(config.verify_url, options).body |> Poison.decode! + headers = [{"Content-type", "application/x-www-form-urlencoded"}, {"Accept", "application/json"}] + + HTTPoison.post!(config.verify_url, body_content, headers, timeout: timeout).body + |> Poison.decode! end defp config do @@ -3,7 +3,7 @@ defmodule Recaptcha.Mixfile do def project do [app: :recaptcha, - version: "1.0.2", + version: "1.1.0", elixir: "~> 1.0", description: description, deps: deps, @@ -11,7 +11,7 @@ defmodule Recaptcha.Mixfile do end def application do - [applications: [:logger, :httpotion]] + [applications: [:logger, :httpoison]] end defp description do @@ -22,8 +22,7 @@ defmodule Recaptcha.Mixfile do defp deps do [ - {:ibrowse, github: "cmullaparthi/ibrowse", tag: "v4.1.2"}, - {:httpotion, "~> 2.1.0"}, + {:httpoison, "0.7.2"}, {:poison, "~> 1.5"} ] end @@ -1,3 +1,7 @@ -%{"httpotion": {:hex, :httpotion, "2.1.0"}, - "ibrowse": {:git, "git://github.com/cmullaparthi/ibrowse.git", "ea3305d21f37eced4fac290f64b068e56df7de80", [tag: "v4.1.2"]}, - "poison": {:hex, :poison, "1.5.0"}} +%{"hackney": {:hex, :hackney, "1.3.2"}, + "httpoison": {:hex, :httpoison, "0.7.4"}, + "httpotion": {:hex, :httpotion, "2.1.0"}, + "ibrowse": {:git, "https://github.com/cmullaparthi/ibrowse.git", "ea3305d21f37eced4fac290f64b068e56df7de80", [tag: "v4.1.2"]}, + "idna": {:hex, :idna, "1.0.2"}, + "poison": {:hex, :poison, "1.5.0"}, + "ssl_verify_hostname": {:hex, :ssl_verify_hostname, "1.0.5"}} |