diff --git a/.formatter.exs b/.formatter.exs index 525446d..9f411ac 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,4 +1,5 @@ # Used by "mix format" [ - inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"] + inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"], + import_deps: [:plug] ] diff --git a/README.md b/README.md index 561ba08..b998f34 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,8 @@ If you want `PlugMicropub` to serve only a particular route, configure your rout forward "/micropub", to: PlugMicropub, init_opts: [ - handler: MyApp.MicropubHandler, - json_encoder: Poison + handler: MyApp.MicropubHandler, + json_encoder: Poison ] ``` diff --git a/lib/plug_micropub.ex b/lib/plug_micropub.ex index 6bb8ce7..4f553b8 100644 --- a/lib/plug_micropub.ex +++ b/lib/plug_micropub.ex @@ -7,8 +7,8 @@ defmodule PlugMicropub do """ use Plug.Router - plug(:match) - plug(:dispatch) + plug :match + plug :dispatch # Plug Callbacks @@ -64,6 +64,10 @@ defmodule PlugMicropub do end end + match _ do + send_error(conn, {:error, :invalid_request}) + end + # Internal Functions defp send_content(conn, content) do