Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Adzz committed Feb 19, 2025
1 parent ad5136a commit ad56eef
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
58 changes: 29 additions & 29 deletions lib/phoenix/controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -543,12 +543,12 @@ defmodule Phoenix.Controller do

def put_view(%Plug.Conn{} = conn, module) do
raise(AlreadySentError, """
The response was already sent.
the response was already sent.
Status code: `#{conn.status}`
Request path: `#{conn.request_path}`
Method: `#{conn.method}`
View module: `#{inspect(module)}`
Status code: #{conn.status}
Request path: #{conn.request_path}
Method: #{conn.method}
View module: #{inspect(module)}
""")
end

Expand Down Expand Up @@ -589,12 +589,12 @@ defmodule Phoenix.Controller do

def put_new_view(%Plug.Conn{} = conn, module) do
raise(AlreadySentError, """
The response was already sent.
the response was already sent.
Status code: `#{conn.status}`
Request path: `#{conn.request_path}`
Method: `#{conn.method}`
View module: `#{inspect(module)}`
Status code: #{conn.status}
Request path: #{conn.request_path}
Method: #{conn.method}
View module: #{inspect(module)}
""")
end

Expand Down Expand Up @@ -661,12 +661,12 @@ defmodule Phoenix.Controller do
put_private_layout(conn, :phoenix_layout, :replace, layout)
else
raise AlreadySentError, """
The response was already sent.
the response was already sent.
Status code: `#{conn.status}`
Request path: `#{conn.request_path}`
Method: `#{conn.method}`
Layout: `#{inspect(layout)}`
Status code: #{conn.status}
Request path: #{conn.request_path}
Method: #{conn.method}
Layout: #{inspect(layout)}
"""
end
end
Expand Down Expand Up @@ -745,12 +745,12 @@ defmodule Phoenix.Controller do
when (is_tuple(layout) and tuple_size(layout) == 2) or is_list(layout) or layout == false do
unless state in @unsent do
raise(AlreadySentError, """
The response was already sent.
the response was already sent.
Status code: `#{conn.status}`
Request path: `#{conn.request_path}`
Method: `#{conn.method}`
Layout: `#{inspect(layout)}`
Status code: #{conn.status}
Request path: #{conn.request_path}
Method: #{conn.method}
Layout: #{inspect(layout)}
""")
end
put_private_layout(conn, :phoenix_layout, :new, layout)
Expand Down Expand Up @@ -794,12 +794,12 @@ defmodule Phoenix.Controller do
put_private_layout(conn, :phoenix_root_layout, :replace, layout)
else
raise AlreadySentError, """
The response was already sent.
the response was already sent.
Status code: `#{conn.status}`
Request path: `#{conn.request_path}`
Method: `#{conn.method}`
Layout: `#{inspect(layout)}`
Status code: #{conn.status}
Request path: #{conn.request_path}
Method: #{conn.method}
Layout: #{inspect(layout)}
"""
end
end
Expand Down Expand Up @@ -827,11 +827,11 @@ defmodule Phoenix.Controller do

def put_layout_formats(%Plug.Conn{} = conn, _formats) do
raise(AlreadySentError, """
The response was already sent.
the response was already sent.
Status code: `#{conn.status}`
Request path: `#{conn.request_path}`
Method: `#{conn.method}`
Status code: #{conn.status}
Request path: #{conn.request_path}
Method: #{conn.method}
""")
end

Expand Down
10 changes: 5 additions & 5 deletions test/phoenix/controller/controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ defmodule Phoenix.Controller.ControllerTest do
assert layout(conn) == {AppView, :print}

message = """
The response was already sent.
the response was already sent.
Status code: `200`
Request path: `/`
Method: `GET`
Layout: `{AppView, :print}`
Status code: 200
Request path: /
Method: GET
Layout: {AppView, :print}
"""

assert_raise Plug.Conn.AlreadySentError, message, fn ->
Expand Down

0 comments on commit ad56eef

Please sign in to comment.