sanbo110 commited on
Commit
8b9f5fb
·
verified ·
1 Parent(s): 0bb0a19

Update main.go

Browse files
Files changed (1) hide show
  1. main.go +7 -3
main.go CHANGED
@@ -175,11 +175,15 @@ func handleCompletion(c *gin.Context) {
175
  }
176
  upstreamReq.Header.Set("x-vqd-4", token)
177
  upstreamReq.Header.Set("Content-Type", "application/json")
178
-
 
 
 
 
 
179
  client := &http.Client{
180
  Timeout: 30 * time.Second,
181
  }
182
-
183
  resp, err := client.Do(upstreamReq)
184
  if err != nil {
185
  c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Sprintf("请求失败: %v", err)})
@@ -467,4 +471,4 @@ func getIntEnv(key string, fallback int) int {
467
 
468
  func getDurationEnv(key string, fallback int) time.Duration {
469
  return time.Duration(getIntEnv(key, fallback)) * time.Millisecond
470
- }
 
175
  }
176
  upstreamReq.Header.Set("x-vqd-4", token)
177
  upstreamReq.Header.Set("Content-Type", "application/json")
178
+ // just for print info
179
+ jsonData, err := json.Marshal(upstreamReq.Header)
180
+ if err == nil {
181
+ log.Printf("Request Header: %s", jsonData)
182
+ }
183
+ log.Printf("Request Body: %s", body)
184
  client := &http.Client{
185
  Timeout: 30 * time.Second,
186
  }
 
187
  resp, err := client.Do(upstreamReq)
188
  if err != nil {
189
  c.JSON(http.StatusInternalServerError, gin.H{"error": fmt.Sprintf("请求失败: %v", err)})
 
471
 
472
  func getDurationEnv(key string, fallback int) time.Duration {
473
  return time.Duration(getIntEnv(key, fallback)) * time.Millisecond
474
+ }