Small fixes

- Use plug formatter
- Add fallback match
- Remove tabs!
This commit is contained in:
Ryan Johnson 2018-04-11 22:50:37 -07:00
parent 293b660ee9
commit 85c46f927f
3 changed files with 10 additions and 5 deletions

View file

@ -1,4 +1,5 @@
# Used by "mix format" # Used by "mix format"
[ [
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"] inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"],
import_deps: [:plug]
] ]

View file

@ -30,8 +30,8 @@ If you want `PlugMicropub` to serve only a particular route, configure your rout
forward "/micropub", forward "/micropub",
to: PlugMicropub, to: PlugMicropub,
init_opts: [ init_opts: [
handler: MyApp.MicropubHandler, handler: MyApp.MicropubHandler,
json_encoder: Poison json_encoder: Poison
] ]
``` ```

View file

@ -7,8 +7,8 @@ defmodule PlugMicropub do
""" """
use Plug.Router use Plug.Router
plug(:match) plug :match
plug(:dispatch) plug :dispatch
# Plug Callbacks # Plug Callbacks
@ -64,6 +64,10 @@ defmodule PlugMicropub do
end end
end end
match _ do
send_error(conn, {:error, :invalid_request})
end
# Internal Functions # Internal Functions
defp send_content(conn, content) do defp send_content(conn, content) do