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

Use templated URLs with separate params.

Useful when logging or reporting metric per URL.

Examples

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