Skip to content

Commit

Permalink
style: gofumpt
Browse files Browse the repository at this point in the history
  • Loading branch information
ViolaPioggia committed Feb 12, 2024
1 parent 15a5452 commit 2ad57d2
Showing 1 changed file with 10 additions and 37 deletions.
47 changes: 10 additions & 37 deletions adaptor/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,50 +43,24 @@ package adaptor

import (
"context"
"crypto/tls"
"io/ioutil"
"net/http"
"net/url"
"reflect"
"strings"
"testing"
"time"

"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/app/client"
"github.com/cloudwego/hertz/pkg/common/adaptor"
"github.com/cloudwego/hertz/pkg/common/config"
"github.com/cloudwego/hertz/pkg/common/test/assert"
"github.com/cloudwego/hertz/pkg/network"
"github.com/cloudwego/hertz/pkg/network/netpoll"
"github.com/cloudwego/hertz/pkg/network/standard"
"github.com/cloudwego/hertz/pkg/protocol"
"github.com/cloudwego/hertz/pkg/protocol/consts"
"github.com/cloudwego/hertz/pkg/route"
"io/ioutil"
"math/rand"
"net/http"
"net/url"
"reflect"
"strings"
"testing"
"time"
)

type mockDialer struct {
network.Dialer
customDialerFunc func(network, address string, timeout time.Duration, tlsConfig *tls.Config)
network string
address string
timeout time.Duration
}

func newMockDialerWithCustomFunc(network, address string, timeout time.Duration, f func(network, address string, timeout time.Duration, tlsConfig *tls.Config)) network.Dialer {
dialer := standard.NewDialer()
if rand.Intn(2) == 0 {
dialer = netpoll.NewDialer()
}
return &mockDialer{
Dialer: dialer,
customDialerFunc: f,
network: network,
address: address,
timeout: timeout,
}
}

func TestNewHertzHandler(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -304,7 +278,6 @@ func TestParseArgs(t *testing.T) {

err := c.Do(context.Background(), req, resp)
assert.Nil(t, err)

}

func TestCookies(t *testing.T) {
Expand Down Expand Up @@ -394,7 +367,7 @@ func TestHeaders(t *testing.T) {
assert.DeepEqual(t, k, "value1")
c := req.Header.Get("cookie")
assert.DeepEqual(t, c, "cookie=cookie_value")
//assert.DeepEqual(t, req.ContentLength, 15) todo: fix this
// assert.DeepEqual(t, req.ContentLength, 15) todo: fix this
}

hertzHandler := NewHertzHTTPHandler(http.HandlerFunc(handler))
Expand All @@ -420,7 +393,7 @@ func TestHeaders(t *testing.T) {
req.Header.SetCookie("cookie", "cookie_value")
req.Header.SetMethod("GET")
req.Header.InitContentLengthWithValue(14)
//req.Header.SetContentLength(15) todo: fix this
// req.Header.SetContentLength(15) todo: fix this

err := c.Do(context.Background(), req, resp)
assert.Nil(t, err)
Expand Down

0 comments on commit 2ad57d2

Please sign in to comment.