Skip to content

Commit 3532bf6

Browse files
committed
v0.10.0
1 parent 7bd86c1 commit 3532bf6

File tree

3 files changed

+56
-35
lines changed

3 files changed

+56
-35
lines changed

lib/http_router.ex

+31-14
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,13 @@ defmodule HttpRouter do
109109

110110
# Plugs we want early in the stack
111111
parsers_opts = [ parsers: unquote(opts[:parsers]) ]
112-
if :json in parsers_opts[:parsers] do
113-
parsers_opts = parsers_opts
114-
|> Keyword.put(:json_decoder, unquote(opts[:json_decoder]))
115-
end
112+
parsers_opts =
113+
if :json in parsers_opts[:parsers] do
114+
parsers_opts
115+
|> Keyword.put(:json_decoder, unquote(opts[:json_decoder]))
116+
else
117+
parsers_opts
118+
end
116119

117120
plug Plug.Parsers, parsers_opts
118121
end
@@ -126,17 +129,26 @@ defmodule HttpRouter do
126129
defaults = [ { :match, [], true },
127130
{ :dispatch, [], true } ]
128131

129-
if options[:allow_copy_req_content_type] == true do
130-
defaults = [ { :copy_req_content_type, [], true } | defaults ]
131-
end
132+
defaults =
133+
if options[:allow_copy_req_content_type] == true do
134+
[ { :copy_req_content_type, [], true } | defaults ]
135+
else
136+
defaults
137+
end
132138

133-
if options[:allow_method_override] == true do
134-
defaults = [ { Plug.MethodOverride, [], true } | defaults ]
135-
end
139+
defaults =
140+
if options[:allow_method_override] == true do
141+
[ { Plug.MethodOverride, [], true } | defaults ]
142+
else
143+
defaults
144+
end
136145

137-
if options[:allow_head] == true do
138-
defaults = [ { Plug.Head, [], true } | defaults ]
139-
end
146+
defaults =
147+
if options[:allow_head] == true do
148+
[ { Plug.Head, [], true } | defaults ]
149+
else
150+
defaults
151+
end
140152

141153
plugs = Enum.reverse(defaults) ++
142154
Module.get_attribute(env.module, :plugs)
@@ -254,7 +266,12 @@ defmodule HttpRouter do
254266
:update, :patch, :delete ]
255267
# mainly used by `version/2`
256268
prepend_path = Keyword.get opts, :prepend_path, nil
257-
if prepend_path, do: prepend_path = "/" <> prepend_path <> "/"
269+
prepend_path =
270+
if prepend_path do
271+
"/" <> prepend_path <> "/"
272+
else
273+
prepend_path
274+
end
258275

259276
routes =
260277
[ { :get, "#{prepend_path}#{resource}", :index },

mix.exs

+6-7
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ defmodule HttpRouter.Mixfile do
33

44
def project do
55
[ app: :http_router,
6-
version: "0.0.8",
6+
version: "0.10.0",
77
elixir: "~> 1.0",
88
deps: deps,
99
name: "HttpRouter",
1010
package: package,
1111
description: description,
12-
docs: [ readme: "README.md", main: "README" ],
12+
docs: [ main: "HttpRouter" ],
1313
test_coverage: [ tool: ExCoveralls ] ]
1414
end
1515

@@ -21,12 +21,11 @@ defmodule HttpRouter.Mixfile do
2121
defp deps do
2222
[ { :cowboy, "~> 1.0" },
2323
{ :plug, "~> 1.0" },
24-
{ :poison, "~> 1.4" },
24+
{ :poison, "~> 3.0" },
2525
{ :xml_builder, "~> 0.0" },
26-
{ :earmark, "~> 0.1", only: :docs },
27-
{ :ex_doc, "~> 0.7", only: :docs },
28-
{ :inch_ex, "~> 0.3", only: :docs },
29-
{ :excoveralls, "~> 0.3", only: :test },
26+
{ :earmark, "~> 1.0", only: :dev },
27+
{ :ex_doc, "~> 0.14", only: :dev },
28+
{ :excoveralls, "~> 0.5", only: :test },
3029
{ :dialyze, "~> 0.2", only: :test } ]
3130
end
3231

mix.lock

+19-14
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
%{"cowboy": {:hex, :cowboy, "1.0.4"},
2-
"cowlib": {:hex, :cowlib, "1.0.2"},
3-
"dialyze": {:hex, :dialyze, "0.2.0"},
4-
"earmark": {:hex, :earmark, "0.1.17"},
5-
"ex_doc": {:hex, :ex_doc, "0.7.3"},
6-
"excoveralls": {:hex, :excoveralls, "0.3.11"},
7-
"exjsx": {:hex, :exjsx, "3.2.0"},
8-
"hackney": {:hex, :hackney, "1.3.0"},
9-
"idna": {:hex, :idna, "1.0.2"},
1+
%{"certifi": {:hex, :certifi, "0.4.0", "a7966efb868b179023618d29a407548f70c52466bf1849b9e8ebd0e34b7ea11f", [:rebar3], []},
2+
"cowboy": {:hex, :cowboy, "1.0.4", "a324a8df9f2316c833a470d918aaf73ae894278b8aa6226ce7a9bf699388f878", [:rebar, :make], [{:cowlib, "~> 1.0.0", [hex: :cowlib, optional: false]}, {:ranch, "~> 1.0", [hex: :ranch, optional: false]}]},
3+
"cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], []},
4+
"dialyze": {:hex, :dialyze, "0.2.1", "9fb71767f96649020d769db7cbd7290059daff23707d6e851e206b1fdfa92f9d", [:mix], []},
5+
"earmark": {:hex, :earmark, "1.0.1", "2c2cd903bfdc3de3f189bd9a8d4569a075b88a8981ded9a0d95672f6e2b63141", [:mix], []},
6+
"ex_doc": {:hex, :ex_doc, "0.14.2", "c89d60db464e8a0849a35dbcd6eed71f2b076c339d0b05b3bb5c90d6bab31e4f", [:mix], [{:earmark, "~> 1.0", [hex: :earmark, optional: false]}]},
7+
"excoveralls": {:hex, :excoveralls, "0.5.6", "35a903f6f78619ee7f951448dddfbef094b3a0d8581657afaf66465bc930468e", [:mix], [{:exjsx, "~> 3.0", [hex: :exjsx, optional: false]}, {:hackney, ">= 0.12.0", [hex: :hackney, optional: false]}]},
8+
"exjsx": {:hex, :exjsx, "3.2.1", "1bc5bf1e4fd249104178f0885030bcd75a4526f4d2a1e976f4b428d347614f0f", [:mix], [{:jsx, "~> 2.8.0", [hex: :jsx, optional: false]}]},
9+
"hackney": {:hex, :hackney, "1.6.1", "ddd22d42db2b50e6a155439c8811b8f6df61a4395de10509714ad2751c6da817", [:rebar3], [{:certifi, "0.4.0", [hex: :certifi, optional: false]}, {:idna, "1.2.0", [hex: :idna, optional: false]}, {:metrics, "1.0.1", [hex: :metrics, optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, optional: false]}, {:ssl_verify_fun, "1.1.0", [hex: :ssl_verify_fun, optional: false]}]},
10+
"idna": {:hex, :idna, "1.2.0", "ac62ee99da068f43c50dc69acf700e03a62a348360126260e87f2b54eced86b2", [:rebar3], []},
1011
"inch_ex": {:hex, :inch_ex, "0.3.3"},
11-
"jsx": {:hex, :jsx, "2.6.2"},
12-
"plug": {:hex, :plug, "1.1.1"},
13-
"poison": {:hex, :poison, "1.4.0"},
14-
"ranch": {:hex, :ranch, "1.2.1"},
12+
"jsx": {:hex, :jsx, "2.8.0", "749bec6d205c694ae1786d62cea6cc45a390437e24835fd16d12d74f07097727", [:mix, :rebar], []},
13+
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], []},
14+
"mime": {:hex, :mime, "1.0.1", "05c393850524767d13a53627df71beeebb016205eb43bfbd92d14d24ec7a1b51", [:mix], []},
15+
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], []},
16+
"plug": {:hex, :plug, "1.2.2", "cfbda521b54c92ab8ddffb173fbaabed8d8fc94bec07cd9bb58a84c1c501b0bd", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, optional: true]}, {:mime, "~> 1.0", [hex: :mime, optional: false]}]},
17+
"poison": {:hex, :poison, "3.0.0", "625ebd64d33ae2e65201c2c14d6c85c27cc8b68f2d0dd37828fde9c6920dd131", [:mix], []},
18+
"ranch": {:hex, :ranch, "1.2.1", "a6fb992c10f2187b46ffd17ce398ddf8a54f691b81768f9ef5f461ea7e28c762", [:make], []},
19+
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.0", "edee20847c42e379bf91261db474ffbe373f8acb56e9079acb6038d4e0bf414f", [:rebar, :make], []},
1520
"ssl_verify_hostname": {:hex, :ssl_verify_hostname, "1.0.5"},
16-
"xml_builder": {:hex, :xml_builder, "0.0.6"}}
21+
"xml_builder": {:hex, :xml_builder, "0.0.8", "dea10735e15c91e24582e41ee2d3282b7f0177a5b42d6268096a6221ba83226f", [:mix], []}}

0 commit comments

Comments
 (0)