zhoufan 4 lat temu
rodzic
commit
b96fb51c24

+ 4 - 4
CallCenterCommon/CallCenter.Utility/Http/HttpMethods.cs

@@ -19,7 +19,7 @@ namespace CallCenter.Utility
19 19
         /// <param name="url">URL.</param>
20 20
         /// <param name="param">POST的数据</param>
21 21
         /// <returns></returns>
22
-        public static string HttpPost(string url, string param = null)
22
+        public static string HttpPost(string url, string param = null, string contentType = "application/x-www-form-urlencoded")
23 23
         {
24 24
             HttpWebRequest request;
25 25
 
@@ -36,7 +36,7 @@ namespace CallCenter.Utility
36 36
             }
37 37
 
38 38
             request.Method = "POST";
39
-            request.ContentType = "application/x-www-form-urlencoded";
39
+            request.ContentType = contentType;
40 40
             request.Accept = "*/*";
41 41
             request.Timeout = 15000;
42 42
             request.AllowAutoRedirect = false;
@@ -61,9 +61,9 @@ namespace CallCenter.Utility
61 61
                     reader.Close();
62 62
                 }
63 63
             }
64
-            catch (Exception)
64
+            catch (Exception ex)
65 65
             {
66
-                throw;
66
+                LogFactory.GetLogger("HttpPost").Error(ex.ToString());
67 67
             }
68 68
             finally
69 69
             {