forked from getsentry/sentry-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpStatusCodeRangeExtensions.cs
More file actions
25 lines (23 loc) · 1.14 KB
/
HttpStatusCodeRangeExtensions.cs
File metadata and controls
25 lines (23 loc) · 1.14 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
namespace Sentry;
/// <summary>
/// Extension methods for collections of <see cref="HttpStatusCodeRange"/>.
/// </summary>
internal static class HttpStatusCodeRangeExtensions
{
/// <summary>
/// Checks if any range in the collection contains the given status code.
/// </summary>
/// <param name="ranges">Collection of ranges to check.</param>
/// <param name="statusCode">Status code to check.</param>
/// <returns>True if any range contains the given status code.</returns>
internal static bool ContainsStatusCode(this IEnumerable<HttpStatusCodeRange> ranges, int statusCode)
=> ranges.Any(range => range.Contains(statusCode));
/// <summary>
/// Checks if any range in the collection contains the given status code.
/// </summary>
/// <param name="ranges">Collection of ranges to check.</param>
/// <param name="statusCode">Status code to check.</param>
/// <returns>True if any range contains the given status code.</returns>
internal static bool ContainsStatusCode(this IEnumerable<HttpStatusCodeRange> ranges, HttpStatusCode statusCode)
=> ranges.ContainsStatusCode((int)statusCode);
}