From 7e95271a90e62a88677354f0cd9ec7feff977340 Mon Sep 17 00:00:00 2001 From: Yordis Prieto Date: Thu, 27 Jun 2024 12:46:56 -0400 Subject: [PATCH] chore: add explanation to keep request middleware (#688) --- lib/tesla/middleware/keep_request.ex | 10 +++++++++- mix.exs | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/tesla/middleware/keep_request.ex b/lib/tesla/middleware/keep_request.ex index 84a2494f..4036f354 100644 --- a/lib/tesla/middleware/keep_request.ex +++ b/lib/tesla/middleware/keep_request.ex @@ -1,6 +1,6 @@ defmodule Tesla.Middleware.KeepRequest do @moduledoc """ - Store request url ,body and headers into `:opts`. + Store request url, body and headers into `:opts`. ## Examples @@ -26,6 +26,14 @@ defmodule Tesla.Middleware.KeepRequest do env.opts[:req_url] # => "http://localhost:8000/users/:user_id ``` + + ## Observability + + In practice, you would combine `Tesla.Middleware.KeepRequest`, `Tesla.Middleware.PathParams`, and + `Tesla.Middleware.Telemetry` to observe the request and response data. + Keep in mind that the request order matters. Make sure to put `Tesla.Middleware.KeepRequest` before + `Tesla.Middleware.PathParams` to make sure that the request data is stored before the path parameters are replaced. + While keeping in mind that this is an application-specific concern, this is the overall recommendation. """ @behaviour Tesla.Middleware diff --git a/mix.exs b/mix.exs index 29261cf1..3a45e7d8 100644 --- a/mix.exs +++ b/mix.exs @@ -2,7 +2,7 @@ defmodule Tesla.Mixfile do use Mix.Project @source_url "https://github.com/teamon/tesla" - @version "1.11.0" + @version "1.11.1" def project do [