当前位置: 首页>>代码示例>>C#>>正文


C# HttpHeaders.Contains方法代码示例

本文整理汇总了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));
                };
        }
开发者ID:vtex,项目名称:workspaces-client-net,代码行数:16,代码来源:HeadersContainItemsConstraint.cs

示例2: GetHttpRequestHeader

        private static string GetHttpRequestHeader(HttpHeaders headers, string headerName)
        {
            if (!headers.Contains(headerName))
                return string.Empty;

            return headers.GetValues(headerName)
                            .SingleOrDefault();
        }
开发者ID:nexaddo,项目名称:WebAPI.Hmac,代码行数:8,代码来源:AuthenticateAttribute.cs

示例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;
		}
开发者ID:bbqchickenrobot,项目名称:ravendb,代码行数:13,代码来源:SynchronizationController.cs

示例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());
        }
开发者ID:ZiNETHQ,项目名称:sif3-framework-dotnet,代码行数:15,代码来源:HttpUtils.cs

示例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);
        }
开发者ID:ZiNETHQ,项目名称:sif3-framework-dotnet,代码行数:18,代码来源:HttpUtils.cs


注:本文中的HttpHeaders.Contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。