Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add explanation to keep request middleware #688

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading