TeslaKeys.Middleware.Remapper (tesla_keys v0.1.3)

Tesla Middleware for remapping the body keys of the request and response. This middlware will convert all the keys of the body by their respective relation defined in the options before sending the request and after receiving the response

Examples

defmodule MyClient do
  use Tesla
  plug TeslaKeys.Middleware.Remapper, keys: %{
    # key expected by API => key you want to handle instead
    "pong" => "ping",
    "bar" => "foo",
    "bye" => "hey"
  }
end

Options

  • :keys - relation of keys expected by the API and that you want to handle