aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Alekseev <justmichael@mail.ru>2015-10-05 21:10:37 +0600
committerMichael Alekseev <justmichael@mail.ru>2015-10-05 21:10:37 +0600
commitb86a7c8ed256a4e62799d284982cc8b68a573381 (patch)
treec7f2e8a721759dd8ed1746269baf2465364a926c
parentbf91eadbcaf8a31b79ebe618e5d4a599d4af5f37 (diff)
downloadrecaptcha-b86a7c8ed256a4e62799d284982cc8b68a573381.tar.gz
recaptcha-b86a7c8ed256a4e62799d284982cc8b68a573381.tar.xz
moved from httpotion to httpoison
-rw-r--r--README.md3
-rw-r--r--lib/recaptcha.ex9
-rw-r--r--mix.exs7
-rw-r--r--mix.lock10
4 files changed, 16 insertions, 13 deletions
diff --git a/README.md b/README.md
index f2a8bf4..8864e16 100644
--- a/README.md
+++ b/README.md
@@ -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
diff --git a/mix.exs b/mix.exs
index b7a0ae2..7dcc1a0 100644
--- a/mix.exs
+++ b/mix.exs
@@ -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
diff --git a/mix.lock b/mix.lock
index 1109ea8..eac4b1b 100644
--- a/mix.lock
+++ b/mix.lock
@@ -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"}}