Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ This release introduces deprecation warnings for several features that have been

* The `config` variable is no longer available in `Phoenix.Endpoint`. In the past, it was possible to read your endpoint configuration at compile-time via an injected variable named `config`, which is no longer supported. Use `Application.compile_env/3` instead, which is tracked by the Elixir compiler and lead to a better developer experience. This may also lead to errors on application boot if you were previously incorrectly setting compile time config at runtime.

## 1.9.0

This release requires Plug v1.21+.

### Enhancements
- [Router] Add the `query` macro for routing HTTP QUERY (RFC 10008) requests ([#6737](https://github.com/phoenixframework/phoenix/pull/6737))

## 1.8.8 (2026-06-10)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion guides/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Inside the scope block, however, we have our first actual route:
get "/", PageController, :home
```

`get` is a Phoenix macro that corresponds to the HTTP verb GET. Similar macros exist for other HTTP verbs, including POST, PUT, PATCH, DELETE, OPTIONS, CONNECT, TRACE, and HEAD.
`get` is a Phoenix macro that corresponds to the HTTP verb GET. Similar macros exist for other HTTP verbs, including QUERY, POST, PUT, PATCH, DELETE, OPTIONS, CONNECT, TRACE, and HEAD.

> #### Why the macros? {: .info}
>
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ defmodule Phoenix.Router do

alias Phoenix.Router.{Resource, Scope, Route, Helpers}

@http_methods [:get, :post, :put, :patch, :delete, :options, :connect, :trace, :head]
@http_methods [:get, :query, :post, :put, :patch, :delete, :options, :connect, :trace, :head]

@doc false
defmacro __using__(opts) do
Expand Down
2 changes: 1 addition & 1 deletion lib/phoenix/test/conn_test.ex
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ defmodule Phoenix.ConnTest do
|> Conn.put_private(:phoenix_recycled, true)
end

@http_methods [:get, :post, :put, :patch, :delete, :options, :connect, :trace, :head]
@http_methods [:get, :query, :post, :put, :patch, :delete, :options, :connect, :trace, :head]

for method <- @http_methods do
@doc """
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ defmodule Phoenix.MixProject do

defp deps do
[
{:plug, "~> 1.14"},
{:plug, "~> 1.21"},
{:plug_crypto, "~> 1.2 or ~> 2.0"},
{:telemetry, "~> 0.4 or ~> 1.0"},
{:phoenix_pubsub, "~> 2.1"},
Expand Down
8 changes: 8 additions & 0 deletions test/phoenix/router/routing_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ defmodule Phoenix.Router.RoutingTest do
def options(conn, _params), do: text(conn, "users options")
def connect(conn, _params), do: text(conn, "users connect")
def trace(conn, _params), do: text(conn, "users trace")
def query(conn, _params), do: text(conn, "users query")
def not_found(conn, _params), do: text(put_status(conn, :not_found), "not found")
def image(conn, _params), do: text(conn, conn.params["path"] || "show files")
def move(conn, _params), do: text(conn, "users move")
Expand Down Expand Up @@ -56,6 +57,7 @@ defmodule Phoenix.Router.RoutingTest do
trace("/trace", UserController, :trace)
options "/options", UserController, :options
connect "/connect", UserController, :connect
query "/query", UserController, :query
match :move, "/move", UserController, :move
match :*, "/any", UserController, :any

Expand Down Expand Up @@ -185,6 +187,12 @@ defmodule Phoenix.Router.RoutingTest do
assert conn.resp_body == "users trace"
end

test "query to custom action" do
conn = call(Router, :query, "/query")
assert conn.status == 200
assert conn.resp_body == "users query"
end

test "splat arg with preceding named parameter to files/:user_name/*path" do
conn = call(Router, :get, "/files/elixir/Users/home/file.txt")
assert conn.status == 200
Expand Down