Releases: danschultzer/idempotency_plug
Releases · danschultzer/idempotency_plug
v0.2.1
v0.2.0
This is a breaking release.
If you have been using the Idempotency.Handler behaviour, change your plug to this:
plug IdempotencyPlug,
tracker: MyAppWeb.RequestTracker,
idempotency_key: {MyAppWeb.IdempotencyPlugHandler, :scope_idempotency_key},
with: {MyAppWeb.IdempotencyPlugHandler, :handle_error}
And change your handler module to this:
defmodule MyAppWeb.IdempotencyPlugHandler do
import Phoenix.Controller
import Plug.Conn
def scope_idempotency_key(conn, key), do: {conn.assigns.current_user.id, key}
def handle_error(conn, error) do
conn
|> put_status(Plug.Exception.status(error))
|> json(%{error: error.message})
|> halt()
end
end
Changes
v0.1.2
v0.1.1
v0.1.0
Plug that makes POST and PATCH requests idempotent using Idempotency-Key
HTTP header.