Bloom.Api.PretendRequestInfo.PretendRequestInfo C# (CSharp) Method

PretendRequestInfo() public method

public PretendRequestInfo ( string url, HttpMethods httpMethod = HttpMethods.Get, bool forPrinting = false, bool forSrcAttr = false ) : System.Collections.Specialized
url string
httpMethod HttpMethods
forPrinting bool
forSrcAttr bool
return System.Collections.Specialized
        public PretendRequestInfo(string url, HttpMethods httpMethod = HttpMethods.Get, bool forPrinting = false, bool forSrcAttr = false)
        {
            HttpMethod = httpMethod;
            if (forPrinting)
                url = url.Replace("/bloom/", "/bloom/OriginalImages/");

            // In the real request, RawUrl does not include this prefix
            RawUrl = url.Replace(ServerBase.ServerUrl, "");

            // When JavaScript inserts a real path into the html it replaces the three magic html characters with these substitutes.
            // For this PretendRequestInfo we simulate that by doing the replace here in the url.
            if (forSrcAttr)
                url = EnhancedImageServer.SimulateJavaScriptHandlingOfHtml(url);

            // Reducing the /// emulates a behavior of the real HttpListener
            LocalPathWithoutQuery = url.Replace(ServerBase.ServerUrl, "").Replace("/bloom/OriginalImages///", "/bloom/OriginalImages/").Replace("/bloom///", "/bloom/").UnescapeCharsForHttp();
        }