Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 14:15 UTC
Minor cleanup, resolve a couple lint warnings
Matthew Holt committed
Aug 29, 2022 at 12:31 UTC
8cb3cf540c2d083721a1717b9ddf2657b7eb5102
2 files changed
+7
-7
caddytest/integration/stream_test.go
+4
-6
@@ -123,8 +123,8 @@ func TestH2ToH2CStream(t *testing.T) {
123
// Disable any compression method from server.
124
req.Header.Set("Accept-Encoding", "identity")
125
126
- resp := tester.AssertResponseCode(req, 200)
127
- if 200 != resp.StatusCode {
126
+ resp := tester.AssertResponseCode(req, http.StatusOK)
127
+ if resp.StatusCode != http.StatusOK {
128
return
129
}
130
go func() {
@@ -143,7 +143,6 @@ func TestH2ToH2CStream(t *testing.T) {
143
if !strings.Contains(body, expectedBody) {
144
t.Errorf("requesting \"%s\" expected response body \"%s\" but got \"%s\"", req.RequestURI, expectedBody, body)
145
}
146
- return
146
}
147
148
func testH2ToH2CStreamServeH2C(t *testing.T) *http.Server {
@@ -335,8 +334,8 @@ func TestH2ToH1ChunkedResponse(t *testing.T) {
334
fmt.Fprint(w, expectedBody)
335
w.Close()
336
}()
338
- resp := tester.AssertResponseCode(req, 200)
339
- if 200 != resp.StatusCode {
337
+ resp := tester.AssertResponseCode(req, http.StatusOK)
338
+ if resp.StatusCode != http.StatusOK {
339
return
340
}
341
@@ -351,7 +350,6 @@ func TestH2ToH1ChunkedResponse(t *testing.T) {
350
if body != expectedBody {
351
t.Errorf("requesting \"%s\" expected response body \"%s\" but got \"%s\"", req.RequestURI, expectedBody, body)
352
}
354
- return
353
}
354
355
func testH2ToH1ChunkedResponseServeH1(t *testing.T) *http.Server {
modules/caddyhttp/reverseproxy/reverseproxy.go
+3
-1
@@ -46,7 +46,9 @@ import (
46
var supports1xx bool
47
48
func init() {
49
- supports1xx = !regexp.MustCompile(`^go1\.1(?:7|8)\.`).Match([]byte(runtime.Version()))
49
+ // Caddy requires at least Go 1.18, but Early Hints requires Go 1.19; thus we can simply check for 1.18 in version string
50
+ // TODO: remove this once our minimum Go version is 1.19
51
+ supports1xx = !strings.Contains(runtime.Version(), "go1.18")
52
53
caddy.RegisterModule(Handler{})
54
}