本文整理汇总了C#中HttpHeaders.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# HttpHeaders.Contains方法的具体用法?C# HttpHeaders.Contains怎么用?C# HttpHeaders.Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpHeaders
的用法示例。
在下文中一共展示了HttpHeaders.Contains方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HaveOneMatchingItemWithin
private static Func<KeyValuePair<string, string>, bool> HaveOneMatchingItemWithin(HttpHeaders headers)
{
return item =>
{
if (!headers.Contains(item.Key))
{
return false;
}
var expectedValues = Regex.Split(item.Value, @",\s*");
var actualValues = headers.GetValues(item.Key);
return headers.Contains(item.Key)
&& expectedValues.OrderBy(i => i).SequenceEqual(actualValues.OrderBy(i => i));
};
}
示例2: GetHttpRequestHeader
private static string GetHttpRequestHeader(HttpHeaders headers, string headerName)
{
if (!headers.Contains(headerName))
return string.Empty;
return headers.GetValues(headerName)
.SingleOrDefault();
}
示例3: GetFilteredMetadataFromHeaders
protected override RavenJObject GetFilteredMetadataFromHeaders(HttpHeaders headers)
{
var result = base.GetFilteredMetadataFromHeaders(headers);
if (headers.Contains(Constants.RavenLastModified))
{
// this is required to resolve conflicts based on last modification date
result.Add(Constants.RavenLastModified, headers.GetValues(Constants.RavenLastModified).First());
}
return result;
}
示例4: HasPagingHeaders
/// <summary>
/// Determine whether paging parameters have been specified.
/// </summary>
/// <param name="headers">Request headers.</param>
/// <exception cref="ArgumentNullException">Parameter is null.</exception>
/// <returns>True if paging parameters have been found; false otherwise.</returns>
internal static bool HasPagingHeaders(HttpHeaders headers)
{
if (headers == null)
{
throw new ArgumentNullException("headers");
}
return headers.Contains(RequestHeader.navigationPage.ToDescription()) || headers.Contains(RequestHeader.navigationPageSize.ToDescription());
}
示例5: HasMethodOverrideHeader
/// <summary>
/// Determine whether a method override has been specified.
/// </summary>
/// <param name="headers">Request headers.</param>
/// <exception cref="ArgumentNullException">Parameter is null.</exception>
/// <returns>True if method override header found; false otherwise.</returns>
internal static bool HasMethodOverrideHeader(HttpHeaders headers)
{
if (headers == null)
{
throw new ArgumentNullException("headers");
}
bool hasMethodOverride = headers.Contains(RequestHeader.methodOverride.ToDescription());
bool hasMethodOverrideSif = headers.Contains(RequestHeader.methodOverrideSif.ToDescription());
return (hasMethodOverride || hasMethodOverrideSif);
}