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
25 lines (18 loc) · 741 Bytes
/
HttpContext.cs
File metadata and controls
25 lines (18 loc) · 741 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
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; }
}
}