From c5e7e1f4f64f8532bf9ff8cda3801c69dc46e0ea Mon Sep 17 00:00:00 2001 From: Evan O'Brien Date: Sun, 22 Feb 2026 18:43:02 +0000 Subject: [PATCH] Allow passing `client_opts` to Electric.Client.new/1 --- lib/phoenix/sync/electric.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/phoenix/sync/electric.ex b/lib/phoenix/sync/electric.ex index 87a2b06..fdd306a 100644 --- a/lib/phoenix/sync/electric.ex +++ b/lib/phoenix/sync/electric.ex @@ -528,7 +528,11 @@ defmodule Phoenix.Sync.Electric do defp http_mode_plug_opts(electric_config) do with {:ok, client} <- configure_client(electric_config, :http) do # don't decode the body - just pass it directly - client = %{client | fetch: {Electric.Client.Fetch.HTTP, [request: [raw: true]]}} + request_opts = + Keyword.get(electric_config, :request_opts, []) + |> Keyword.merge(raw: true) + + client = %{client | fetch: {Electric.Client.Fetch.HTTP, [request: request_opts]}} {:ok, %Phoenix.Sync.Electric.ClientAdapter{client: client}} end end