Tesla.Middleware.PathParams (tesla v1.4.0) View Source

Use templated URLs with separate params.

Useful when logging or reporting metric per URL.

Example usage

defmodule MyClient do
  use Tesla

  plug Tesla.Middleware.BaseUrl, "https://api.example.com"
  plug Tesla.Middleware.Logger # or some monitoring middleware
  plug Tesla.Middleware.PathParams

  def user(id) do
    params = [id: id]
    get("/users/:id", opts: [path_params: params])
  end
end