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

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