private string GetHttpMethodFromParameter(ServiceAttributeParameterInfo parameter) { var httpMethod = parameter.Value.ToUpperInvariant(); if (!s_httpMethods.Contains(httpMethod)) { AddValidationError(new ServiceDefinitionError($"Unsupported HTTP method '{httpMethod}'.", parameter.GetPart(ServicePartKind.Value)?.Position)); return(null); } return(httpMethod); }
private protected HttpStatusCode?TryParseStatusCodeInteger(ServiceAttributeParameterInfo parameter) { int.TryParse(parameter.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var valueAsInteger); if (valueAsInteger < 200 || valueAsInteger >= 599) { AddValidationError(new ServiceDefinitionError($"'{parameter.Name}' parameter must be an integer between 200 and 599.", parameter.GetPart(ServicePartKind.Value)?.Position)); return(null); } return((HttpStatusCode)valueAsInteger); }