Binboo.Jira.Integration.JiraHttp.JiraHttpProxy.ResponseFor C# (CSharp) Method

ResponseFor() private static method

private static ResponseFor ( Stream responseStream, bool versobe ) : string
responseStream Stream
versobe bool
return string
        private static string ResponseFor(Stream responseStream, bool versobe)
        {
            HtmlDocument htmlDocument = new HtmlDocument();
            htmlDocument.Load(responseStream);

            HtmlNode found = htmlDocument.DocumentNode.SelectSingleNode("//select[@name='linkDesc']");
            if (found != null)
            {
                string escapedErrorMessage = htmlDocument.DocumentNode.SelectSingleNode("//span[@class='errMsg']").InnerText.Trim();
                var errorMessage = HttpUtility.HtmlDecode(escapedErrorMessage);

                HtmlNodeCollection validLinkOptions = found.SelectNodes("option");
                if (validLinkOptions == null) return null;

                return errorMessage + (versobe
                                        ? "\r\nValid link descriptions: \r\n" + validLinkOptions.Aggregate("", (agg, current) => agg + "      \"" + current.NextSibling.InnerText.Trim() + "\"\r\n")
                                        : "");
            }

            return null;
        }