aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/request.go
diff options
context:
space:
mode:
authorChen.Zhidong <njutczd@gmail.com>2024-05-16 16:27:58 +0000
committerJonathan Amsterdam <jba@google.com>2024-05-16 18:42:34 +0000
commita523152ea1df8d39d923ed90d19662896eff0607 (patch)
treea962a3f08a8394371615995b982b42f10efb9b9c /src/net/http/request.go
parent06b45781603ec6998012ac63b2c0bda32600f682 (diff)
downloadgo-a523152ea1df8d39d923ed90d19662896eff0607.tar.xz
net/http: add Pattern field in Request to return matched pattern info
Fixes #66405 Change-Id: Icd80944b6ca081aa7addd4fb85d2b3c29b6c9542 GitHub-Last-Rev: c6e32742c4b733230c82627571b423de45997c24 GitHub-Pull-Request: golang/go#66618 Reviewed-on: https://go-review.googlesource.com/c/go/+/574997 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/net/http/request.go')
-rw-r--r--src/net/http/request.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/net/http/request.go b/src/net/http/request.go
index bdd18adf3f..f208b95c46 100644
--- a/src/net/http/request.go
+++ b/src/net/http/request.go
@@ -320,6 +320,10 @@ type Request struct {
// redirects.
Response *Response
+ // Pattern is the [ServeMux] pattern that matched the request.
+ // It is empty if the request was not matched against a pattern.
+ Pattern string
+
// ctx is either the client or server context. It should only
// be modified via copying the whole Request using Clone or WithContext.
// It is unexported to prevent people from using Context wrong