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

Store request body & headers into opts.

Example

defmodule MyClient do
  use Tesla

  plug Tesla.Middleware.KeepRequest
end

{:ok, env} = MyClient.post("/", "request-data")

env.body
# => "response-data"

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

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