Browse Source

coinex http请求失败打印原响应数据

JiahengHe 1 year ago
parent
commit
984c910ed8
1 changed files with 5 additions and 2 deletions
  1. 5 2
      exchanges/src/coinex_swap_rest.rs

+ 5 - 2
exchanges/src/coinex_swap_rest.rs

@@ -6,7 +6,7 @@ use hex;
 use reqwest::Client;
 use rust_decimal::Decimal;
 use rust_decimal_macros::dec;
-use serde_json::Value;
+use serde_json::{json, Value};
 use crate::http_tool::RestTool;
 use crate::response_base::ResponseData;
 use sha2::{Digest, Sha256};
@@ -629,7 +629,9 @@ impl CoinexSwapRest {
 
         // 读取响应的内容
         let response = request_builder.send().await.unwrap();
-        info!("url: {}, 原始http响应:response: {:?}", url, response);
+        // 原始响应数据
+        let res_json = format!("url: {}, response: {:?}", url, response);
+        // info!("url: {}, http响应:response: {:?}", url, response);
         let is_success = response.status().is_success(); // 先检查状态码
 
         let text = response.text().await.unwrap();
@@ -638,6 +640,7 @@ impl CoinexSwapRest {
         return if is_success && data_json["code"].to_string() == "0" {
             self.on_success_data(data_json["data"].clone())
         } else {
+            info!("原始http 响应数据:{}", res_json);
             self.on_error_data(&text, &url, &body)
         };
     }