Tesla.Middleware.KeepRequest (tesla v1.6.0) View Source

Store request url ,body and headers into :opts.

Examples

defmodule MyClient do
  use Tesla

  plug Tesla.Middleware.KeepRequest
  plug Tesla.Middleware.PathParams
end

{:ok, env} = MyClient.post("/users/:user_id", "request-data", opts: [path_params: [user_id: "1234]])

env.body
# => "response-data"

env.opts[:req_body]
# => "request-data"

env.opts[:req_headers]
# => [{"request-headers", "are-safe"}, ...]

env.opts[:req_url]
# => "http://localhost:8000/users/:user_id