Skip to content

Releases: danschultzer/idempotency_plug

v0.2.1

28 Apr 14:47
Compare
Choose a tag to compare

Relaxed dependency requirements for ecto and ecto_sql. #3

v0.2.0

12 Apr 18:16
Compare
Choose a tag to compare

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

  • IdempotencyPlug.Handler removed #2
  • IdempotencyPlug raises errors by default #2
  • IdempotencyPlug now accepts :idempotency_key, :request_payload, :hash, and :with options #2
  • IdempotencyPlug now requires :tracker option #2
  • SHA256 hashing now accepts Erlang terms instead of just binary #1 #2

v0.1.2

07 Apr 22:46
Compare
Choose a tag to compare
  • Fix source url and name in docs 7b27d59

v0.1.1

07 Apr 17:32
Compare
Choose a tag to compare
  • Fix indention for generated Ecto migration bd8e16c

v0.1.0

07 Apr 03:06
Compare
Choose a tag to compare

Plug that makes POST and PATCH requests idempotent using Idempotency-Key HTTP header.