优化细节

This commit is contained in:
liyp 2024-04-15 15:26:46 +08:00
parent 2ae8789fef
commit c7ce482511

View file

@ -92,17 +92,17 @@ func (s *StdAns) SendMsg(msg string) bool {
fmt.Println("Error marshaling JSON:", err) fmt.Println("Error marshaling JSON:", err)
return false return false
} }
re, err := json.MarshalIndent(requestBody, "", " ") _, err = json.MarshalIndent(requestBody, "", " ")
if err != nil { if err != nil {
fmt.Println("Error marshaling JSON:", err) fmt.Println("Error marshaling JSON:", err)
return false return false
} }
fmt.Println(string(re)) // fmt.Println(string(re))
url := config.GlobalConfig.Server.POSTURL url := config.GlobalConfig.Server.POSTURL
// println("core:", url) // println("core:", url)
fmt.Println("请求地址:", url) // fmt.Println("请求地址:", url)
fmt.Println("响应信息:", msg) fmt.Println("响应信息:\n", msg)
resp, err := http.Post(url, "application/json", bytes.NewBuffer(requestBody)) resp, err := http.Post(url, "application/json", bytes.NewBuffer(requestBody))
if err != nil { if err != nil {
fmt.Println("Error sending request:", err) fmt.Println("Error sending request:", err)