Skip to content

Commit a50df4f

Browse files
author
0bl
authored
🩹 Fix: rename WithTlsConfig method to WithTLSConfig (#2570)
* 🩹 Fix: rename WithTlsConfig method to WithTLSConfig * 🎨 Style: remove stylecheck and revive lint
1 parent 44acb06 commit a50df4f

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

docs/api/middleware/proxy.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ After you initiate your Fiber app, you can use the following possibilities:
4242

4343
```go
4444
// if target https site uses a self-signed certificate, you should
45-
// call WithTlsConfig before Do and Forward
46-
proxy.WithTlsConfig(&tls.Config{
45+
// call WithTLSConfig before Do and Forward
46+
proxy.WithTLSConfig(&tls.Config{
4747
InsecureSkipVerify: true,
4848
})
4949
// if you need to use global self-custom client, you should use proxy.WithClient.

middleware/proxy/proxy.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,10 @@ var client = &fasthttp.Client{
105105

106106
var lock sync.RWMutex
107107

108-
// WithTlsConfig update http client with a user specified tls.config
108+
// WithTLSConfig update http client with a user specified tls.config
109109
// This function should be called before Do and Forward.
110110
// Deprecated: use WithClient instead.
111-
//
112-
//nolint:stylecheck,revive // TODO: Rename to "WithTLSConfig" in v3
113-
func WithTlsConfig(tlsConfig *tls.Config) {
111+
func WithTLSConfig(tlsConfig *tls.Config) {
114112
client.TLSConfig = tlsConfig
115113
}
116114

middleware/proxy/proxy_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ func Test_Proxy(t *testing.T) {
104104
require.Equal(t, fiber.StatusTeapot, resp.StatusCode)
105105
}
106106

107-
// go test -run Test_Proxy_Balancer_WithTlsConfig
108-
func Test_Proxy_Balancer_WithTlsConfig(t *testing.T) {
107+
// go test -run Test_Proxy_Balancer_WithTLSConfig
108+
func Test_Proxy_Balancer_WithTLSConfig(t *testing.T) {
109109
t.Parallel()
110110

111111
serverTLSConf, _, err := tlstest.GetTLSConfigs()
@@ -144,8 +144,8 @@ func Test_Proxy_Balancer_WithTlsConfig(t *testing.T) {
144144
require.Equal(t, "tls balancer", body)
145145
}
146146

147-
// go test -run Test_Proxy_Forward_WithTlsConfig_To_Http
148-
func Test_Proxy_Forward_WithTlsConfig_To_Http(t *testing.T) {
147+
// go test -run Test_Proxy_Forward_WithTLSConfig_To_Http
148+
func Test_Proxy_Forward_WithTLSConfig_To_Http(t *testing.T) {
149149
t.Parallel()
150150

151151
_, targetAddr := createProxyTestServer(t, func(c fiber.Ctx) error {
@@ -203,8 +203,8 @@ func Test_Proxy_Forward(t *testing.T) {
203203
require.Equal(t, "forwarded", string(b))
204204
}
205205

206-
// go test -run Test_Proxy_Forward_WithTlsConfig
207-
func Test_Proxy_Forward_WithTlsConfig(t *testing.T) {
206+
// go test -run Test_Proxy_Forward_WithTLSConfig
207+
func Test_Proxy_Forward_WithTLSConfig(t *testing.T) {
208208
t.Parallel()
209209

210210
serverTLSConf, _, err := tlstest.GetTLSConfigs()
@@ -225,7 +225,7 @@ func Test_Proxy_Forward_WithTlsConfig(t *testing.T) {
225225
clientTLSConf := &tls.Config{InsecureSkipVerify: true} //nolint:gosec // We're in a test func, so this is fine
226226

227227
// disable certificate verification
228-
WithTlsConfig(clientTLSConf)
228+
WithTLSConfig(clientTLSConf)
229229
app.Use(Forward("https://" + addr + "/tlsfwd"))
230230

231231
go func() {

0 commit comments

Comments
 (0)