1
0
Fork 0

Merge current v2.8 into master

This commit is contained in:
kevinpollet 2022-08-18 14:50:44 +02:00
commit 626da4c0ae
No known key found for this signature in database
GPG key ID: 0C9A5DDD1B292453
90 changed files with 1019 additions and 707 deletions

View file

@ -827,7 +827,7 @@ func BenchmarkRouterServe(b *testing.B) {
b.Cleanup(func() { server.Close() })
res := &http.Response{
StatusCode: 200,
StatusCode: http.StatusOK,
Body: io.NopCloser(strings.NewReader("")),
}
@ -879,7 +879,7 @@ func BenchmarkRouterServe(b *testing.B) {
func BenchmarkService(b *testing.B) {
res := &http.Response{
StatusCode: 200,
StatusCode: http.StatusOK,
Body: io.NopCloser(strings.NewReader("")),
}

View file

@ -9,6 +9,7 @@ import (
"io"
"net"
"net/http"
"net/url"
"strings"
"testing"
"time"
@ -109,8 +110,13 @@ func Test_Routing(t *testing.T) {
for {
conn, err := tcpBackendListener.Accept()
if err != nil {
var netErr net.Error
if errors.As(err, &netErr) && netErr.Temporary() {
var opErr *net.OpError
if errors.As(err, &opErr) && opErr.Temporary() {
continue
}
var urlErr *url.Error
if errors.As(err, &urlErr) && urlErr.Temporary() {
continue
}

View file

@ -7,6 +7,7 @@ import (
stdlog "log"
"net"
"net/http"
"net/url"
"os"
"strings"
"sync"
@ -195,8 +196,13 @@ func (e *TCPEntryPoint) Start(ctx context.Context) {
if err != nil {
logger.Error(err)
var netErr net.Error
if errors.As(err, &netErr) && netErr.Temporary() {
var opErr *net.OpError
if errors.As(err, &opErr) && opErr.Temporary() {
continue
}
var urlErr *url.Error
if errors.As(err, &urlErr) && urlErr.Temporary() {
continue
}

View file

@ -20,7 +20,7 @@ func (t *staticTransport) RoundTrip(r *http.Request) (*http.Response, error) {
func BenchmarkProxy(b *testing.B) {
res := &http.Response{
StatusCode: 200,
StatusCode: http.StatusOK,
Body: io.NopCloser(strings.NewReader("")),
}

View file

@ -456,7 +456,7 @@ func TestWebSocketUpgradeFailed(t *testing.T) {
mux := http.NewServeMux()
mux.HandleFunc("/ws", func(w http.ResponseWriter, req *http.Request) {
w.WriteHeader(400)
w.WriteHeader(http.StatusBadRequest)
})
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
mux.ServeHTTP(w, req)
@ -472,7 +472,7 @@ func TestWebSocketUpgradeFailed(t *testing.T) {
req.URL.Path = path
f.ServeHTTP(w, req)
} else {
w.WriteHeader(200)
w.WriteHeader(http.StatusOK)
}
}))
defer proxy.Close()