File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed
Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -600,7 +600,7 @@ defmodule Phoenix.Sync.Electric do
600600 def map_response_body ( body , mapper ) when is_binary ( body ) and is_function ( mapper , 1 ) do
601601 body
602602 |> @ json . decode! ( )
603- |> Phoenix.Sync.Electric . map_response_body ( mapper )
603+ |> map_response_body ( mapper )
604604 |> then ( fn item -> [ @ json . encode_to_iodata! ( item ) ] end )
605605 end
606606
Original file line number Diff line number Diff line change @@ -55,11 +55,10 @@ if Code.ensure_loaded?(Electric.Shapes.Api) do
5555 end
5656
5757 defp apply_transform ( stream , transform_fun ) do
58- Stream . flat_map ( stream , fn chunk ->
59- chunk
60- |> IO . iodata_to_binary ( )
61- |> Phoenix.Sync.Electric . map_response_body ( transform_fun )
62- end )
58+ stream
59+ |> Enum . to_list ( )
60+ |> IO . iodata_to_binary ( )
61+ |> Phoenix.Sync.Electric . map_response_body ( transform_fun )
6362 end
6463 end
6564 end
Original file line number Diff line number Diff line change @@ -58,10 +58,14 @@ defmodule Phoenix.Sync.Electric.ClientAdapter do
5858 end
5959
6060 body =
61- Phoenix.Sync.Electric . map_response_body (
62- response . body ,
63- PredefinedShape . transform_fun ( shape )
64- )
61+ if response . status in 200 .. 299 do
62+ Phoenix.Sync.Electric . map_response_body (
63+ response . body ,
64+ PredefinedShape . transform_fun ( shape )
65+ )
66+ else
67+ response . body
68+ end
6569
6670 conn
6771 |> put_headers ( response . headers )
You can’t perform that action at this time.
0 commit comments