1: void preventCallsToJS(object sender, PostRequestEventArgs e) {
2: List<WebTestRequest> requestsToRemove = new List<WebTestRequest>()
3: foreach (WebTestRequest linkToRemove in e.Request.DependentRequest
4: if (linkToRemove.Url.EndsWith("someJavaScriptFile.js")) {
5: requestsToRemove.Add(linkToRemove);
6: }
7: };
8: foreach (WebTestRequest linkToRemove in requestsToRemove) {
9: e.Request.DependentRequests.Remove(linkToRemove);
10: };
11: }
For each request I have added the call to the above PostRequest like this:
1: request4.PostRequest += new EventHandler<PostRequestEventArgs>(preventCallsToJS);
No more problems hitting those pesky not yet deployed .js files. w00t!
No comments:
Post a Comment