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();
}