From 5dc3cc86f5835369cd830f2a83318b9a8d69cf69 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期二, 15 七月 2025 16:20:19 +0800
Subject: [PATCH] 11
---
MES.Service/Dto/webApi/RealTimeInventory/HttpClientEx.cs | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/MES.Service/Dto/webApi/RealTimeInventory/HttpClientEx.cs b/MES.Service/Dto/webApi/RealTimeInventory/HttpClientEx.cs
index 2ac48c6..e7311a2 100644
--- a/MES.Service/Dto/webApi/RealTimeInventory/HttpClientEx.cs
+++ b/MES.Service/Dto/webApi/RealTimeInventory/HttpClientEx.cs
@@ -4,25 +4,25 @@
namespace MES.Service.Dto.webApi.RealTimeInventory;
-public
+public
// HTTP瀹㈡埛绔被锛岀敤浜庡彂閫佽姹傚拰鑾峰彇鍝嶅簲
class HttpClientEx
{
+ private static readonly CookieContainer Cookie = new();
public string Url { get; set; }
public string Content { get; set; }
- static CookieContainer Cookie = new CookieContainer();
public string AsyncRequest()
{
- HttpWebRequest httpRequest = HttpWebRequest.Create(Url) as HttpWebRequest;
+ var httpRequest = HttpWebRequest.Create(Url) as HttpWebRequest;
httpRequest.Method = "POST";
httpRequest.ContentType = "application/json";
httpRequest.CookieContainer = Cookie;
httpRequest.Timeout = 1000 * 60 * 10; // 10鍒嗛挓瓒呮椂
- using (Stream reqStream = httpRequest.GetRequestStream())
+ using (var reqStream = httpRequest.GetRequestStream())
{
- JObject jObj = new JObject
+ var jObj = new JObject
{
{ "format", 1 },
{ "useragent", "ApiClient" },
@@ -32,7 +32,7 @@
{ "v", "1.0" }
};
- string sContent = jObj.ToString();
+ var sContent = jObj.ToString();
var bytes = UnicodeEncoding.UTF8.GetBytes(sContent);
reqStream.Write(bytes, 0, bytes.Length);
reqStream.Flush();
@@ -46,4 +46,4 @@
}
}
}
-}
+}
\ No newline at end of file
--
Gitblit v1.9.3