Repository: quic-go/quic-go
Pull request #4466 (2024-04-26 20:21:15)

http3: rename Settings.EnableDatagram to EnableDatagrams
This makes it consistent with the `quic.Config` and the config flag on the `http3.Server` and `http3.RoundTripper`.

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/quic-go/quic-go/pull/4466?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=quic-go) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 84.80%. Comparing base [(`e1e5b62`)](https://app.codecov.io/gh/quic-go/quic-go/commit/e1e5b6294d2cca73f0664f879889780cfa2ae51d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=quic-go) to head [(`a286382`)](https://app.codecov.io/gh/quic-go/quic-go/pull/4466?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=quic-go).


<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##           master    #4466   +/-   ##
=======================================
  Coverage   84.80%   84.80%           
=======================================
  Files         154      154           
  Lines       14645    14645           
=======================================
  Hits        12419    12419           
  Misses       1714     1714           
  Partials      512      512           
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/quic-go/quic-go/pull/4466?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=quic-go).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=quic-go).


Patch:
diff --git a/http3/conn.go b/http3/conn.go
index 55e199a8..ee465886 100644
--- a/http3/conn.go
+++ b/http3/conn.go
@@ -212,7 +212,7 @@ func (c *connection) HandleUnidirectionalStreams(hijack func(StreamType, quic.Co
 				return
 			}
 			c.settings = &Settings{
-				EnableDatagram:        sf.Datagram,
+				EnableDatagrams:       sf.Datagram,
 				EnableExtendedConnect: sf.ExtendedConnect,
 				Other:                 sf.Other,
 			}
diff --git a/http3/roundtrip.go b/http3/roundtrip.go
index e25c2dac..148e3373 100644
--- a/http3/roundtrip.go
+++ b/http3/roundtrip.go
@@ -21,7 +21,7 @@ import (
 // Settings are HTTP/3 settings that apply to the underlying connection.
 type Settings struct {
 	// Support for HTTP/3 datagrams (RFC 9297)
-	EnableDatagram bool
+	EnableDatagrams bool
 	// Extended CONNECT, RFC 9220
 	EnableExtendedConnect bool
 	// Other settings, defined by the application
diff --git a/http3/server.go b/http3/server.go
index 7935db47..3f53db2c 100644
--- a/http3/server.go
+++ b/http3/server.go
@@ -167,7 +167,7 @@ type Server struct {
 	Handler http.Handler
 
 	// EnableDatagrams enables support for HTTP/3 datagrams (RFC 9297).
-	// If set to true, QUICConfig.EnableDatagram will be set.
+	// If set to true, QUICConfig.EnableDatagrams will be set.
 	EnableDatagrams bool
 
 	// MaxHeaderBytes controls the maximum number of bytes the server will


Test patch:
diff --git a/http3/conn_test.go b/http3/conn_test.go
index 2ca9473b..4aa6e423 100644
--- a/http3/conn_test.go
+++ b/http3/conn_test.go
@@ -47,7 +47,7 @@ var _ = Describe("Connection", func() {
 				conn.HandleUnidirectionalStreams(nil)
 			}()
 			Eventually(conn.ReceivedSettings()).Should(BeClosed())
-			Expect(conn.Settings().EnableDatagram).To(BeTrue())
+			Expect(conn.Settings().EnableDatagrams).To(BeTrue())
 			Expect(conn.Settings().EnableExtendedConnect).To(BeTrue())
 			Expect(conn.Settings().Other).To(HaveKeyWithValue(uint64(1337), uint64(42)))
 			Eventually(done).Should(BeClosed())
diff --git a/http3/roundtrip_test.go b/http3/roundtrip_test.go
index 35b22af1..fb081abe 100644
--- a/http3/roundtrip_test.go
+++ b/http3/roundtrip_test.go
@@ -181,7 +181,7 @@ var _ = Describe("RoundTripper", func() {
 		Expect(err).To(MatchError(testErr))
 	})
 
-	It("requires quic.Config.EnableDatagram if HTTP/3 datagrams are enabled", func() {
+	It("requires quic.Config.EnableDatagrams if HTTP/3 datagrams are enabled", func() {
 		rt := &RoundTripper{
 			QUICConfig:      &quic.Config{EnableDatagrams: false},
 			EnableDatagrams: true,
diff --git a/integrationtests/self/http_test.go b/integrationtests/self/http_test.go
index 73113d2d..c8c018ff 100644
--- a/integrationtests/self/http_test.go
+++ b/integrationtests/self/http_test.go
@@ -611,7 +611,7 @@ var _ = Describe("HTTP tests", func() {
 		Eventually(hconn.ReceivedSettings(), 5*time.Second, 10*time.Millisecond).Should(BeClosed())
 		settings := hconn.Settings()
 		Expect(settings.EnableExtendedConnect).To(BeTrue())
-		Expect(settings.EnableDatagram).To(BeFalse())
+		Expect(settings.EnableDatagrams).To(BeFalse())
 		Expect(settings.Other).To(BeEmpty())
 	})
 
@@ -642,7 +642,7 @@ var _ = Describe("HTTP tests", func() {
 		var settings *http3.Settings
 		Expect(settingsChan).To(Receive(&settings))
 		Expect(settings).ToNot(BeNil())
-		Expect(settings.EnableDatagram).To(BeTrue())
+		Expect(settings.EnableDatagrams).To(BeTrue())
 		Expect(settings.EnableExtendedConnect).To(BeFalse())
 		Expect(settings.Other).To(HaveKeyWithValue(uint64(1337), uint64(42)))
 	})
@@ -732,7 +732,7 @@ var _ = Describe("HTTP tests", func() {
 				Expect(r.Method).To(Equal(http.MethodConnect))
 				conn := w.(http3.Hijacker).Connection()
 				Eventually(conn.ReceivedSettings()).Should(BeClosed())
-				Expect(conn.Settings().EnableDatagram).To(BeTrue())
+				Expect(conn.Settings().EnableDatagrams).To(BeTrue())
 				w.WriteHeader(http.StatusOK)
 				w.(http.Flusher).Flush()