Skip to content

Commit ee0bb1c

Browse files
committed
whitespace
1 parent 002c9c9 commit ee0bb1c

File tree

5 files changed

+32
-32
lines changed

5 files changed

+32
-32
lines changed

lib/http_router.ex

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@ defmodule HttpRouter do
77
88
method route [guard], handler, action
99
10-
`method` is `get`, `post`, `put`, `patch`, or `delete`, each
11-
responsible for a single HTTP method. `method` can also be `any`, which will
10+
`method` is `get`, `post`, `put`, `patch`, or `delete`, each
11+
responsible for a single HTTP method. `method` can also be `any`, which will
1212
match on all HTTP methods. `options` is yet another option for `method`, but
1313
when using `options`, only a route path and the methods that route path
14-
supports are needed. `handler` is any valid Elixir module name, and
14+
supports are needed. `handler` is any valid Elixir module name, and
1515
`action` is any valid public function defined in the `handler` module.
1616
17-
`get/3`, `post/3`, `put/3`, `patch/3`, `delete/3`, `options/2`, and `any/3`
18-
are already built-in as described. `resource/2` exists but will need
17+
`get/3`, `post/3`, `put/3`, `patch/3`, `delete/3`, `options/2`, and `any/3`
18+
are already built-in as described. `resource/2` exists but will need
1919
modifications to create everything as noted.
2020
21-
`raw/4` allows for using custom HTTP methods, allowing your application to be
21+
`raw/4` allows for using custom HTTP methods, allowing your application to be
2222
HTTP spec compliant.
2323
24-
`version/2` allows requests to contained endpoints when version exists in
24+
`version/2` allows requests to contained endpoints when version exists in
2525
either `Accept` header or URL (which ever is defined in the app config).
2626
27-
Extra routes will be added for `*.json`, `*.xml`, etc. requests for optionally
28-
specifying desired content type without the use of the `Accept` header. These
27+
Extra routes will be added for `*.json`, `*.xml`, etc. requests for optionally
28+
specifying desired content type without the use of the `Accept` header. These
2929
match parsing/rendering abilities of HttpRouter.
3030
3131
## Example
@@ -37,15 +37,15 @@ defmodule HttpRouter do
3737
# with a simple version number "1"
3838
# or following semver "1.0.0"
3939
# or date of release "2014-09-06"
40-
version "1" do
40+
version "1" do
4141
# Define your routes here
4242
get "/", Handlers.V1.Pages, :index
4343
get "/pages", Handlers.V1.Pages, :create
4444
post "/pages", Handlers.V1.Pages, :create
4545
put "/pages/:page_id" when id == 1,
4646
Handlers.V1.Pages, :update_only_one
4747
get "/pages/:page_id", Handlers.V1.Pages, :show
48-
48+
4949
# Auto-create a full set of routes for resources
5050
#
5151
resource :users, Handlers.V1.User, arg: :user_id
@@ -64,14 +64,14 @@ defmodule HttpRouter do
6464
end
6565
6666
# An updated version of the AP
67-
version "2" do
67+
version "2" do
6868
get "/", Handlers.V2.Pages, :index
6969
post "/pages", Handlers.V2.Pages, :create
7070
get "/pages/:page_id", Handlers.V2.Pages, :show
7171
put "/pages/:page_id", Handlers.V2.Pages, :update
7272
7373
raw :trace, "/trace", Handlers.V2.Tracer, :trace
74-
74+
7575
resource :users, Handlers.V2.User
7676
resource :groups, Handlers.V2.Group
7777
end
@@ -98,8 +98,8 @@ defmodule HttpRouter do
9898
# Plugs we want early in the stack
9999
# plug HttpRouter.Request.TranslateExtensions
100100
add_parsers = Application.get_env(:http_router, :parsers, [])
101-
plug Plug.Parsers, parsers: [ :json,
102-
:urlencoded,
101+
plug Plug.Parsers, parsers: [ :json,
102+
:urlencoded,
103103
:multipart ]
104104
++ add_parsers
105105
end
@@ -110,11 +110,11 @@ defmodule HttpRouter do
110110
# Plugs we want predefined but aren't necessary to be before
111111
# user-defined plugs
112112
defaults = [ { Plug.Head, [], true },
113-
{ Plug.MethodOverride, [], true },
114-
{ :copy_req_content_type, [], true },
113+
{ Plug.MethodOverride, [], true },
114+
{ :copy_req_content_type, [], true },
115115
{ :match, [], true },
116116
{ :dispatch, [], true } ]
117-
{ conn, body } = Enum.reverse(defaults) ++
117+
{ conn, body } = Enum.reverse(defaults) ++
118118
Module.get_attribute(env.module, :plugs)
119119
|> Plug.Builder.compile
120120

@@ -150,7 +150,7 @@ defmodule HttpRouter do
150150
# Our default match so `Plug` doesn't fall on
151151
# its face when accessing an undefined route.
152152
def do_match(_,_) do
153-
fn conn ->
153+
fn conn ->
154154
conn |> send_resp(404, "")
155155
end
156156
end
@@ -228,11 +228,11 @@ defmodule HttpRouter do
228228
arg = Keyword.get opts, :arg, :id
229229
allowed = Keyword.get opts, :only, [ :index, :create, :show,
230230
:update, :patch, :delete ]
231-
# mainly used by `version/2`
231+
# mainly used by `version/2`
232232
prepend_path = Keyword.get opts, :prepend_path, nil
233233
if prepend_path, do: prepend_path = "/" <> prepend_path <> "/"
234234

235-
routes =
235+
routes =
236236
[ { :get, "#{prepend_path}#{resource}", :index },
237237
{ :post, "#{prepend_path}#{resource}", :create },
238238
{ :get, "#{prepend_path}#{resource}/:#{arg}", :show },
@@ -274,9 +274,9 @@ defmodule HttpRouter do
274274
end
275275

276276
defp ignore_args(str) do
277-
str
278-
|> String.to_char_list
279-
|> do_ignore_args
277+
str
278+
|> String.to_char_list
279+
|> do_ignore_args
280280
|> to_string
281281
end
282282

@@ -317,9 +317,9 @@ defmodule HttpRouter do
317317
# Builds a `do_match/2` function body for a given route.
318318
defp build_match(:options, route, allows, caller) do
319319
body = quote do
320-
conn
321-
|> Plug.Conn.resp(200, "")
322-
|> Plug.Conn.put_resp_header("Allow", unquote(allows))
320+
conn
321+
|> Plug.Conn.resp(200, "")
322+
|> Plug.Conn.put_resp_header("Allow", unquote(allows))
323323
|> Plug.Conn.send_resp
324324
end
325325

@@ -358,7 +358,7 @@ defmodule HttpRouter do
358358

359359
quote do
360360
opts = [ action: unquote(action), args: binding() ]
361-
unquote(handler).call %{ conn | req_headers: unquote(header) ++
361+
unquote(handler).call %{ conn | req_headers: unquote(header) ++
362362
conn.req_headers }, unquote(handler).init(opts)
363363
end
364364
end

lib/http_router/util.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ defmodule HttpRouter.Util do
8686
defp binary_to_identifier(prefix, _) do
8787
raise InvalidSpecError, message: "#{prefix} in routes must be followed by lowercase letters"
8888
end
89-
end
89+
end

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule HttpRouter.Mixfile do
33

44
def project do
55
[ app: :http_router,
6-
version: "0.0.1",
6+
version: "0.0.1-dev",
77
elixir: "~> 1.0",
88
deps: deps,
99
name: "HttpRouter",

test/http_router/util_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ defmodule HttpRouter.UtilTest do
4444
build_spec("bin/*sh/json", nil)
4545
end
4646
end
47-
end
47+
end

test/http_router_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ defmodule HttpRouterTest do
300300
raw :trace, "/trace", Foo, :trace
301301

302302
resource :users, Bar
303-
resource :comments, Baz, prepend_path: "/users/:user_id",
303+
resource :comments, Baz, prepend_path: "/users/:user_id",
304304
only: [:index]
305305
end
306306

0 commit comments

Comments
 (0)