-
Notifications
You must be signed in to change notification settings - Fork 9.8k
/
HeaderPropagationContext.cs
45 lines (38 loc) · 1.63 KB
/
HeaderPropagationContext.cs
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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
namespace Microsoft.AspNetCore.HeaderPropagation;
/// <summary>
/// A context object for <see cref="HeaderPropagationEntry.ValueFilter"/> delegates.
/// </summary>
public readonly struct HeaderPropagationContext
{
/// <summary>
/// Initializes a new instance of <see cref="HeaderPropagationContext"/> with the provided
/// <paramref name="httpContext"/>, <paramref name="headerName"/> and <paramref name="headerValue"/>.
/// </summary>
/// <param name="httpContext">The <see cref="Http.HttpContext"/> associated with the current request.</param>
/// <param name="headerName">The header name.</param>
/// <param name="headerValue">The header value present in the current request.</param>
public HeaderPropagationContext(HttpContext httpContext, string headerName, StringValues headerValue)
{
ArgumentNullException.ThrowIfNull(httpContext);
ArgumentNullException.ThrowIfNull(headerName);
HttpContext = httpContext;
HeaderName = headerName;
HeaderValue = headerValue;
}
/// <summary>
/// Gets the <see cref="Http.HttpContext"/> associated with the current request.
/// </summary>
public HttpContext HttpContext { get; }
/// <summary>
/// Gets the header name.
/// </summary>
public string HeaderName { get; }
/// <summary>
/// Gets the header value from the current request.
/// </summary>
public StringValues HeaderValue { get; }
}