Commit e6e2f325 e6e2f325ff72b6364e8f93aa9c92a209ee1786f0 by Christian Gerdes

Modified Extract Cookie to use the built in cookie parser instead.

1 parent bd414362
...@@ -130,26 +130,17 @@ namespace LIL_VSTT_Plugins ...@@ -130,26 +130,17 @@ namespace LIL_VSTT_Plugins
130 130
131 public override void Extract(object sender, ExtractionEventArgs e) 131 public override void Extract(object sender, ExtractionEventArgs e)
132 { 132 {
133 WebHeaderCollection col = e.Response.Headers; 133 foreach (Cookie ck in e.Response.Cookies)
134 foreach (string h in col.Keys)
135 { 134 {
136 if(h.Equals("Set-Cookie")) 135 if(ck.Name.Equals(cookieName))
137 { 136 {
138 string[] cookie = col[h].Split('='); 137 e.WebTest.Context.Add(this.ContextParameterName, WebUtility.UrlDecode(ck.Value));
139 if(cookie[0].Equals(cookieName)) 138 e.Success = true;
140 { 139 e.Message = "Cookie found";
141 string value = ""; 140 return;
142 if (cookie.Length > 1)
143 {
144 value = cookie[1].Split(';')[0];
145 }
146 e.WebTest.Context.Add(this.ContextParameterName, WebUtility.UrlDecode(value));
147 e.Success = true;
148 e.Message = "Cookie found";
149 return;
150 }
151 } 141 }
152 } 142 }
143
153 e.Success = false; 144 e.Success = false;
154 e.Message = "Cookie not found"; 145 e.Message = "Cookie not found";
155 } 146 }
......