public void ProcessRequest(HttpContext context) { var url = context.Request.RawUrl.Substring(context.Request.RawUrl.IndexOf("test=") + 5); var response = new WebClientWrapper().DownloadString(url); var config = RequestReduce.Api.Registry.Configuration; config.BaseAddress = url; context.Response.Write(response); }
public void WillThrowErrorIfNotJavaScript() { var wrapper = new WebClientWrapper(); var ex = Assert.Throws<InvalidOperationException>(() => wrapper.Download<JavaScriptResource>("http://localhost:8877/local.html")); Assert.NotNull(ex); }
public void WillNotIncludeUtf8PreambleInstring() { var wrapper = new WebClientWrapper(); var result = wrapper.DownloadString("http://localhost:8877/styles/style1.css"); Assert.False(result.StartsWith(Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble()))); }
public void ProcessRequest(HttpContext context) { var url = context.Request.RawUrl.Substring(context.Request.RawUrl.IndexOf("test=") + 5); var response = new WebClientWrapper().DownloadString(url); var config = Api.Registry.Configuration; config.BaseAddress = url; //config.ContentHost = "http://requestreduce.org"; if (response.IndexOf("<base ", StringComparison.OrdinalIgnoreCase) == -1) response = response.Replace("<head>", string.Format(@"<head><base href=""{0}""></base>", url)); context.Response.Write(response); }
public void WillThrowErrorIfNotJavaScript() { if (ConfigurationManager.AppSettings["Environment"] == "Test") return; var wrapper = new WebClientWrapper(); var ex = Assert.Throws<InvalidOperationException>(() => wrapper.Download<JavaScriptResource>("http://localhost:8877/local.html")); Assert.NotNull(ex); }
public void WillNotIncludeUtf8PreambleInstring() { if (ConfigurationManager.AppSettings["Environment"] == "Test") return; var wrapper = new WebClientWrapper(); var result = wrapper.DownloadString("http://localhost:8877/styles/style1.css"); Assert.False(result.StartsWith(Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble()))); }
public override MethodResult Execute(object testClass) { MethodResult result = null; try { result = base.Execute(testClass); } finally { if (!(result is PassedResult)) { var trace = new WebClientWrapper().DownloadString("http://localhost:8877/local.html?OutputError=1&OutputTrace=1"); output.WriteLine(trace); if(output != Console.Out) Console.Out.WriteLine(trace); } } return result; }