Example #1
0
        public static string GetUriTemplateString(this HttpOperationDescription operation)
        {
            if (operation == null)
            {
                throw new ArgumentNullException("operation");
            }

            WebGetAttribute    webGet    = operation.GetWebGetAttribute();
            WebInvokeAttribute webInvoke = operation.GetWebInvokeAttribute();

            if (webGet != null && webGet.UriTemplate != null)
            {
                return(webGet.UriTemplate);
            }

            if (webInvoke != null && webInvoke.UriTemplate != null)
            {
                return(webInvoke.UriTemplate);
            }

            if (operation.GetWebMethod() == "GET")
            {
                return(GetDefaultWebGetUriTemplate(operation));
            }

            return(operation.Name);
        }
Example #2
0
        public static string GetWebMethod(this HttpOperationDescription operation)
        {
            WebGetAttribute webGet = operation.GetWebGetAttribute();

            if (webGet != null)
            {
                return("GET");
            }

            WebInvokeAttribute webInvoke = operation.GetWebInvokeAttribute();

            if (webInvoke == null)
            {
                return("POST");
            }

            return(webInvoke.Method ?? "POST");
        }