lith 4 lat temu
rodzic
commit
c43d681283

+ 20 - 1
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/Extensions/RpcContextDataExtensions.cs

@@ -167,7 +167,7 @@ namespace Vit.Extensions
 
 
 
-        #region Content-Type
+        #region ContentType
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static String http_header_ContentType_Get(this RpcContextData data)
         {
@@ -182,6 +182,25 @@ namespace Vit.Extensions
         }
         #endregion
 
+        #region ContentType
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static String http_header_Get(this RpcContextData data, string key)
+        {
+            return data.http.GetHeader(key);
+        }
+
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static RpcContextData http_header_Set(this RpcContextData data, string key, String value)
+        {
+            data.http.Headers()[key] = value;
+            return data;
+        }
+        #endregion
+        
+
+
+
+
 
 
         #region apiStationName_Get

+ 2 - 4
dotnet/Library/Sers/Sers.Core/Sers.Core/Module/Rpc/RpcContextData.cs

@@ -156,8 +156,7 @@ namespace Sers.Core.Module.Rpc
             [MethodImpl(MethodImplOptions.AggressiveInlining)]
             public Dictionary<string, string> Headers()
             {
-                if (headers == null) headers = new Dictionary<string, string>();
-                return headers;
+                return headers??(headers = new Dictionary<string, string>());
             }
 
             /// <summary>
@@ -168,8 +167,7 @@ namespace Sers.Core.Module.Rpc
             [MethodImpl(MethodImplOptions.AggressiveInlining)]
             public Dictionary<string, string> Headers(int capacity)
             {
-                if (headers == null) headers = new Dictionary<string, string>(capacity);
-                return headers;
+                return headers??(headers = new Dictionary<string, string>(capacity));
             }
 
             [MethodImpl(MethodImplOptions.AggressiveInlining)]