Skip to content

Commit 6c4ef6e

Browse files
committed
Remove syntax to be future deprecated
1 parent d79ed21 commit 6c4ef6e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/phoenix/controller.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ defmodule Phoenix.Controller do
10941094
conn
10951095
else
10961096
content_type = content_type <> "; charset=utf-8"
1097-
%Plug.Conn{conn | resp_headers: [{"content-type", content_type} | resp_headers]}
1097+
%{conn | resp_headers: [{"content-type", content_type} | resp_headers]}
10981098
end
10991099
end
11001100

@@ -1323,15 +1323,15 @@ defmodule Phoenix.Controller do
13231323
13241324
"""
13251325
@spec scrub_params(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
1326-
def scrub_params(conn, required_key) when is_binary(required_key) do
1326+
def scrub_params(%Plug.Conn{} = conn, required_key) when is_binary(required_key) do
13271327
param = Map.get(conn.params, required_key) |> scrub_param()
13281328

13291329
unless param do
13301330
raise Phoenix.MissingParamError, key: required_key
13311331
end
13321332

13331333
params = Map.put(conn.params, required_key, param)
1334-
%Plug.Conn{conn | params: params}
1334+
%{conn | params: params}
13351335
end
13361336

13371337
defp scrub_param(%{__struct__: mod} = struct) when is_atom(mod) do

lib/phoenix/endpoint/render_errors.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ defmodule Phoenix.Endpoint.RenderErrors do
5252
end
5353

5454
@doc false
55-
def __catch__(conn, kind, reason, stack, opts) do
55+
def __catch__(%Plug.Conn{} = conn, kind, reason, stack, opts) do
5656
conn =
5757
receive do
5858
@already_sent ->
5959
send(self(), @already_sent)
60-
%Plug.Conn{conn | state: :sent}
60+
%{conn | state: :sent}
6161
after
6262
0 ->
6363
instrument_render_and_send(conn, kind, reason, stack, opts)
@@ -126,13 +126,13 @@ defmodule Phoenix.Endpoint.RenderErrors do
126126
Controller.render(conn, template, assigns)
127127
end
128128

129-
defp maybe_fetch_query_params(conn) do
129+
defp maybe_fetch_query_params(%Plug.Conn{} = conn) do
130130
fetch_query_params(conn)
131131
rescue
132132
Plug.Conn.InvalidQueryError ->
133133
case conn.params do
134-
%Plug.Conn.Unfetched{} -> %Plug.Conn{conn | query_params: %{}, params: %{}}
135-
params -> %Plug.Conn{conn | query_params: %{}, params: params}
134+
%Plug.Conn.Unfetched{} -> %{conn | query_params: %{}, params: %{}}
135+
params -> %{conn | query_params: %{}, params: params}
136136
end
137137
end
138138

0 commit comments

Comments
 (0)