Skip to content

Commit

Permalink
chore: add explanation to keep request middleware (#688)
Browse files Browse the repository at this point in the history
  • Loading branch information
yordis authored Jun 27, 2024
1 parent d39d575 commit 7e95271
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion lib/tesla/middleware/keep_request.ex
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
[
Expand Down

0 comments on commit 7e95271

Please sign in to comment.