From 8508ec939ae08fd8b8fe9bfbc537106b4429d4eb Mon Sep 17 00:00:00 2001
From: Jonathan Amsterdam New math/rand/v2 package
We plan to include an API migration tool in a future release, likely Go 1.23.
+ HTTP routing in the standard library is now more expressive.
+ The patterns used by net/http.ServeMux
have been enhanced to accept methods and wildcards.
+
+ Registering a handler with a method, like "POST /items/create"
, restricts
+ invocations of the handler to requests with the given method. A pattern with a method takes precedence over a matching pattern without one.
+ As a special case, registering a handler with "GET"
also registers it with "HEAD"
.
+
+ Wildcards in patterns, like /items/{id}
, match segments of the URL path.
+ The actual segment value may be accessed by calling the Request.PathValue
method.
+ A wildcard ending in "...", like /files/{path...}
, must occur at the end of a pattern and matches all the remaining segments.
+
+ A pattern that ends in "/" matches all paths that have it as a prefix, as always.
+ To match the exact pattern including the trailing slash, end it with {$}
,
+ as in /exact/match/{$}
.
+
+ If two patterns overlap in the requests that they match, then the more specific pattern takes precedence. + If neither is more specific, the patterns conflict. + This rule generalizes the original precedence rules and maintains the property that the order in which + patterns are registered does not matter. +
+ +
+ This change breaks backwards compatiblity in small ways, some obvious—patterns with "{" and "}" behave differently—
+ and some less so—treatment of escaped paths has been improved.
+ The change is controlled by a GODEBUG
field named httpmuxgo121
.
+ Set httpmuxgo121=1
to restore the old behavior.
+
@@ -633,14 +672,13 @@
- TODO: https://go.dev/issue/62418: enable setting level on default log.Logger -
- -
- TODO: https://go.dev/cl/525096: log/slog: add LogLoggerLevel to enable setting level on the default logger; modified api/next/62418.txt
+ The new SetLogLoggerLevel
function
+ controls the level for the bridge between the `slog` and `log` packages. It sets the minimum level
+ for calls to the top-level `slog` logging functions, and it sets the level for calls to `log.Logger`
+ that go through `slog`.
fs.FS
.
- - TODO: https://go.dev/issue/61410: enhanced ServeMux routing -
-
The HTTP server and client now reject requests and responses containing
an invalid empty Content-Length
header.
@@ -925,11 +959,8 @@
- TODO: https://go.dev/issue/61758: support sub-tests -
- -
- TODO: https://go.dev/cl/516076: testing/slogtest: add Run to run cases as subtests; modified api/next/61758.txt
+ The new Run
function uses sub-tests to run test cases,
+ providing finer-grained control.