public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) { if (httpContext == null) { throw new ArgumentNullException("httpContext"); } if (m_allowedMethods.Count == 0) { return true; } HttpMethod method = httpContext.GetOverriddenHttpMethod(); return m_allowedMethods.Contains(method); }
private bool IsMatch(HttpContextBase httpContext, Type serviceContractType, string urlTemplate) { ICollection<HttpMethod> allowedHttpMethods = HttpMethodRegistry.GetHttpMethods(new RouteMetadata(serviceContractType.AssemblyQualifiedName, urlTemplate)); HttpMethod httpMethod; try { httpMethod = httpContext.GetOverriddenHttpMethod(); } catch (HttpResponseException) { TryToBrew(httpContext.Request.HttpMethod); throw; } GenerateAllowedMethods(httpContext, allowedHttpMethods); if (!allowedHttpMethods.Contains(httpMethod)) { httpContext.Items[ServiceCallConstants.RouteMethodConstraintFailed] = true; return false; } return m_httpMethods.Contains(httpMethod); }