forked from NetCoreStack/Proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequestContext.cs
More file actions
47 lines (41 loc) · 1.26 KB
/
Copy pathRequestContext.cs
File metadata and controls
47 lines (41 loc) · 1.26 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using NetCoreStack.Proxy.Extensions;
using System;
using System.Diagnostics;
using System.Net.Http;
namespace NetCoreStack.Proxy
{
public class RequestContext : IDisposable
{
public ProxyMethodDescriptor MethodDescriptor { get; }
public HttpRequestMessage Request { get; }
public string RegionKey { get; }
public TimeSpan? Timeout { get; }
public RequestContext(HttpRequestMessage request,
ProxyMethodDescriptor methodDescriptor,
string regionKey,
TimeSpan? timeout = null)
{
if (request == null)
{
throw new ArgumentNullException(nameof(request));
}
if (methodDescriptor == null)
{
throw new ArgumentNullException(nameof(methodDescriptor));
}
if (!regionKey.HasValue())
{
throw new ArgumentNullException(nameof(regionKey));
}
Request = request;
MethodDescriptor = methodDescriptor;
RegionKey = regionKey;
Timeout = timeout;
}
public void Dispose()
{
Debug.WriteLine("===Request Context disposing");
Request.Dispose();
}
}
}