Ver código fonte

[REV] 设定header json格式请求

pujielan 1 mês atrás
pai
commit
1c889cf666
1 arquivos alterados com 3 adições e 2 exclusões
  1. 3 2
      handler/sms.go

+ 3 - 2
handler/sms.go

@@ -64,8 +64,7 @@ func (e *EventHandler) SendMsg() *EventHandler {
 		e.Errs["rander error"] = err
 		return e
 	}
-	timestamp := time.Now().UnixNano() / 1e6
-
+	timestamp := time.Now().UnixNano() / int64(time.Millisecond)
 	headers["x-system-key"] = appkey
 	headers["x-system-nonce"] = nonce.String()
 	headers["x-system-timestamp"] = fmt.Sprintf("%d", timestamp)
@@ -120,6 +119,8 @@ func (e *EventHandler) SendMsg() *EventHandler {
 	for key, value := range headers {
 		req.Header.Set(key, value)
 	}
+	// 设定json格式
+	req.Header.Set("Content-Type", "application/json")
 
 	resp, err := client.Do(req)
 	if err != nil {