From b5a46daa3b60e42c4ee1f32de012a4ed4e2ae95d Mon Sep 17 00:00:00 2001 From: Ashlynne Mitchell Date: Fri, 17 Apr 2026 23:47:21 +1000 Subject: [PATCH] fix: raw_input not being set as request's body in `Atex.XRPC.post/3` --- CHANGELOG.md | 5 ++++- lib/atex/xrpc.ex | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c185b85..8c62afd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - +## [Unreleased] + +- Fix `raw_input` not actually being set as the request's body in + `Atex.XRPC.post/3` when providing a struct as input. ## [0.9.1] - 2026-04-17 diff --git a/lib/atex/xrpc.ex b/lib/atex/xrpc.ex index 26b5d66..4022751 100644 --- a/lib/atex/xrpc.ex +++ b/lib/atex/xrpc.ex @@ -169,9 +169,7 @@ defmodule Atex.XRPC do def post(client, %{__struct__: module} = procedure, opts) do has_raw_input? = - if raw_input = procedure.raw_input do - opts = Keyword.put(opts, :body, raw_input) - + if procedure.raw_input do if Code.ensure_loaded?(module) and function_exported?(module, :content_type, 0) do headers = Keyword.get(opts, :headers, []) @@ -193,7 +191,9 @@ defmodule Atex.XRPC do opts = if has_raw_input? do - put_params(opts, procedure) + opts + |> put_params(procedure) + |> Keyword.put(:body, procedure.raw_input) else opts |> put_params(procedure) -- 2.51.2