Milestones 1 and 2: proxy with timeouts and size limits, rate limits, country lists and the image #40
@@ -5,7 +5,6 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"slices"
|
||||
"strings"
|
||||
@@ -354,15 +353,8 @@ func TestRefusesHeadersOver32KiB(t *testing.T) {
|
||||
func TestAnswers502WhenTheAppCannotBeReached(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
listener, err := (&net.ListenConfig{}).Listen(t.Context(), "tcp", localhost+":0")
|
||||
if err != nil {
|
||||
t.Fatalf("listen: %v", err)
|
||||
}
|
||||
|
||||
closedAddr := listener.Addr().String()
|
||||
_ = listener.Close()
|
||||
|
||||
addr, out := startProxy(t, "http://"+closedAddr, nil)
|
||||
// No test can listen on port 1: listening on port 0 gets one from 32768 up.
|
||||
addr, out := startProxy(t, "http://"+localhost+":1", nil)
|
||||
|
||||
wantStatus(t, get(t, addr, "/"), http.StatusBadGateway)
|
||||
wantLine(t, out.requestLine(t), http.StatusBadGateway,
|
||||
|
||||
Reference in New Issue
Block a user