Skip to content

Commit

Permalink
skip tls
Browse files Browse the repository at this point in the history
  • Loading branch information
bxy4543 committed Sep 10, 2024
1 parent 67e61be commit 5ad4301
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions service/account/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,11 @@ func GetAllRegionConsumptionAmount(c *gin.Context) {
c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Sprintf("failed to marshal request: %v", err)})
return
}
req2, err := http.NewRequest(http.MethodPost, url, bytes.NewBuffer(body))
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: os.Getenv("INSECURE_VERIFY") != "true", MinVersion: tls.VersionTLS13},
}
client := &http.Client{Transport: tr}
req2, err := http.NewRequest("POST", url, bytes.NewBuffer(body))
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Sprintf("failed to create request: %v", err)})
return
Expand All @@ -175,9 +179,10 @@ func GetAllRegionConsumptionAmount(c *gin.Context) {
return
}
req2.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))
resp, err := http.DefaultClient.Do(req2)
req2.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req2)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Sprintf("failed to get consumption amount: %v", err)})
c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Sprintf("failed to send request: %v", err)})
return
}
defer resp.Body.Close()
Expand Down

0 comments on commit 5ad4301

Please sign in to comment.