Skip to content

Commit 7e95271

Browse files
authored
chore: add explanation to keep request middleware (#688)
1 parent d39d575 commit 7e95271

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/tesla/middleware/keep_request.ex

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
defmodule Tesla.Middleware.KeepRequest do
22
@moduledoc """
3-
Store request url ,body and headers into `:opts`.
3+
Store request url, body and headers into `:opts`.
44
55
## Examples
66
@@ -26,6 +26,14 @@ defmodule Tesla.Middleware.KeepRequest do
2626
env.opts[:req_url]
2727
# => "http://localhost:8000/users/:user_id
2828
```
29+
30+
## Observability
31+
32+
In practice, you would combine `Tesla.Middleware.KeepRequest`, `Tesla.Middleware.PathParams`, and
33+
`Tesla.Middleware.Telemetry` to observe the request and response data.
34+
Keep in mind that the request order matters. Make sure to put `Tesla.Middleware.KeepRequest` before
35+
`Tesla.Middleware.PathParams` to make sure that the request data is stored before the path parameters are replaced.
36+
While keeping in mind that this is an application-specific concern, this is the overall recommendation.
2937
"""
3038

3139
@behaviour Tesla.Middleware

mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule Tesla.Mixfile do
22
use Mix.Project
33

44
@source_url "https://github.com/teamon/tesla"
5-
@version "1.11.0"
5+
@version "1.11.1"
66

77
def project do
88
[

0 commit comments

Comments
 (0)