forked from Code-Sharp/uHttpSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpContext.cs
More file actions
26 lines (21 loc) · 725 Bytes
/
Copy pathHttpContext.cs
File metadata and controls
26 lines (21 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System.Dynamic;
using System.Net;
using uhttpsharp.Headers;
namespace uhttpsharp
{
internal class HttpContext : IHttpContext
{
private readonly ExpandoObject state = new ExpandoObject();
public HttpContext(IHttpRequest request, EndPoint remoteEndPoint)
{
Request = request;
RemoteEndPoint = remoteEndPoint;
Cookies = new CookiesStorage(Request.Headers.GetByNameOrDefault("cookie", string.Empty));
}
public IHttpRequest Request { get; }
public IHttpResponse Response { get; set; }
public ICookiesStorage Cookies { get; }
public dynamic State => state;
public EndPoint RemoteEndPoint { get; }
}
}