From 741ae6b466593c9e140da9fa5ffe87f7894b3385 Mon Sep 17 00:00:00 2001
From: steden <1470804@qq.com>
Date: Thu, 20 Jun 2024 17:42:32 +0800
Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=EF=BC=9A=E6=8C=87=E5=AE=9A?=
 =?UTF-8?q?=E4=B8=8D=E9=AA=8C=E8=AF=81https?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 test/jwt_test.go | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/test/jwt_test.go b/test/jwt_test.go
index 7252996..fc66e3d 100644
--- a/test/jwt_test.go
+++ b/test/jwt_test.go
@@ -1,6 +1,7 @@
 package test
 
 import (
+	"crypto/tls"
 	"github.com/farseer-go/fs"
 	"github.com/farseer-go/fs/configure"
 	"github.com/farseer-go/webapi"
@@ -45,7 +46,13 @@ func TestJwt(t *testing.T) {
 	t.Run("test jwt validate error", func(t *testing.T) {
 		newRequest, _ := http.NewRequest("POST", "http://127.0.0.1:8090/jwt/validate", nil)
 		newRequest.Header.Set("Auto_test", "123123123")
-		client := &http.Client{}
+		client := &http.Client{
+			Transport: &http.Transport{
+				TLSClientConfig: &tls.Config{
+					InsecureSkipVerify: true, // 不验证 HTTPS 证书
+				},
+			},
+		}
 		rsp, _ := client.Do(newRequest)
 		rspBytes, _ := io.ReadAll(rsp.Body)
 		assert.Equal(t, configure.GetString("WebApi.Jwt.InvalidMessage"), string(rspBytes))
@@ -55,7 +62,13 @@ func TestJwt(t *testing.T) {
 	t.Run("test jwt validate success", func(t *testing.T) {
 		newRequest, _ := http.NewRequest("POST", "http://127.0.0.1:8090/jwt/validate", nil)
 		newRequest.Header.Set("Auto_test", buildToken)
-		client := &http.Client{}
+		client := &http.Client{
+			Transport: &http.Transport{
+				TLSClientConfig: &tls.Config{
+					InsecureSkipVerify: true, // 不验证 HTTPS 证书
+				},
+			},
+		}
 		rsp, _ := client.Do(newRequest)
 		rspBytes, _ := io.ReadAll(rsp.Body)
 		assert.Equal(t, "hello", string(rspBytes))