From 3f843dd1fc80819613aa1025445851ecc9d96bac Mon Sep 17 00:00:00 2001 From: Wojtek Mach Date: Thu, 1 Aug 2024 22:42:30 +0200 Subject: [PATCH] `encode_body`: Support `%File.Stream{}` from other nodes in `:form_multipart` --- lib/req/utils.ex | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/req/utils.ex b/lib/req/utils.ex index f62c921..adc14e9 100644 --- a/lib/req/utils.ex +++ b/lib/req/utils.ex @@ -375,7 +375,13 @@ defmodule Req.Utils do stream = %File.Stream{} -> filename = Path.basename(stream.path) - size = File.stat!(stream.path).size + + size = + if stream.node == node() do + File.stat!(stream.path).size + else + :erpc.call(stream.node, File, :stat!, [stream.path]).size + end options = options