# SuperPlug
Give your Plug superpowers!
## Usage
``` elixir
defmodule FooPlug do
use SuperPlug
def init(opts) do
...
end
def call(conn, opts) do
...
end
end
```
## Primary Superpower
`call/1` initializes default options.
```elixir
FooPlug.call(conn)
# FooPlug.call(conn, FooPlug.init([]))
```
## Secondary Superpower
`call/2` initializes keyword options.
``` elixir
FooPlug.call(conn, bar?: true)
# FooPlug.call(conn, FooPlug.init(bar?: true))
```
## Tertiary Superpower
`call/2` short circuits if an error is assigned.
``` elixir
conn = %{assigns: %{error: :not_found}}
^conn = FooPlug.call(conn)
```
It can be configured to return the error as a tuple.
``` elixir
defmodule BarPlug do
use SuperPlug, return_error_as_tuple: true
...
end
conn = %{assigns: %{error: :not_found}}
{:error, :not_found, ^conn} = BarPlug.call(conn)
```
## Installation
```elixir
def deps do
[
{:super_plug, "~> 1.1"}
]
end
```