@@ -12,29 +12,27 @@ namespace GenHTTP.Adapters.AspNetCore.Types;
1212
1313public sealed class Request : IRequest
1414{
15- private RequestProperties ? _Properties ;
15+ private RequestProperties ? _properties ;
1616
17- private Query ? _Query ;
17+ private Query ? _query ;
1818
19- private Cookies ? _Cookies ;
19+ private Cookies ? _cookies ;
2020
21- private readonly ForwardingCollection _Forwardings = new ( ) ;
21+ private readonly ForwardingCollection _forwardings = new ( ) ;
2222
23- private Headers ? _Headers ;
24-
25- private readonly IEndPoint ? _EndPoint ;
23+ private Headers ? _headers ;
2624
2725 #region Get-/Setters
2826
2927 public IRequestProperties Properties
3028 {
31- get { return _Properties ??= new RequestProperties ( ) ; }
29+ get { return _properties ??= new RequestProperties ( ) ; }
3230 }
3331
3432 public IServer Server { get ; }
3533
36- public IEndPoint EndPoint => _EndPoint ?? throw new InvalidOperationException ( "EndPoint is not available as it is managed by ASP.NET Core" ) ;
37-
34+ public IEndPoint EndPoint { get ; }
35+
3836 public IClientConnection Client { get ; }
3937
4038 public IClientConnection LocalClient { get ; }
@@ -55,19 +53,19 @@ public IRequestProperties Properties
5553
5654 public IRequestQuery Query
5755 {
58- get { return _Query ??= new Query ( Context ) ; }
56+ get { return _query ??= new Query ( Context ) ; }
5957 }
6058
6159 public ICookieCollection Cookies
6260 {
63- get { return _Cookies ??= new Cookies ( Context ) ; }
61+ get { return _cookies ??= new Cookies ( Context ) ; }
6462 }
6563
66- public IForwardingCollection Forwardings => _Forwardings ;
64+ public IForwardingCollection Forwardings => _forwardings ;
6765
6866 public IHeaderCollection Headers
6967 {
70- get { return _Headers ??= new Headers ( Context ) ; }
68+ get { return _headers ??= new Headers ( Context ) ; }
7169 }
7270
7371 public Stream Content => Context . BodyReader . AsStream ( true ) ;
@@ -101,19 +99,19 @@ public Request(IServer server, HttpContext context)
10199 {
102100 foreach ( var entry in forwardings )
103101 {
104- if ( entry != null ) _Forwardings . Add ( entry ) ;
102+ if ( entry != null ) _forwardings . Add ( entry ) ;
105103 }
106104 }
107105 else
108106 {
109- _Forwardings . TryAddLegacy ( Headers ) ;
107+ _forwardings . TryAddLegacy ( Headers ) ;
110108 }
111109
112110 LocalClient = new ClientConnection ( context . Connection , context . Request ) ;
113111
114- Client = _Forwardings . DetermineClient ( context . Connection . ClientCertificate ) ?? LocalClient ;
112+ Client = _forwardings . DetermineClient ( context . Connection . ClientCertificate ) ?? LocalClient ;
115113
116- _EndPoint = Server . EndPoints . FirstOrDefault ( e => e . Port == context . Connection . LocalPort ) ;
114+ EndPoint = Server . EndPoints . First ( e => e . Port == context . Connection . LocalPort ) ;
117115 }
118116
119117 #endregion
@@ -128,15 +126,15 @@ public Request(IServer server, HttpContext context)
128126
129127 #region Lifecycle
130128
131- private bool _Disposed ;
129+ private bool _disposed ;
132130
133131 public void Dispose ( )
134132 {
135- if ( ! _Disposed )
133+ if ( ! _disposed )
136134 {
137- _Properties ? . Dispose ( ) ;
135+ _properties ? . Dispose ( ) ;
138136
139- _Disposed = true ;
137+ _disposed = true ;
140138 }
141139 }
142140
0 commit comments