Skip to content

Commit

Permalink
Fix #594 - expolrer-ui can handle more than one cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
yonatang authored and dkoszewnik committed Mar 22, 2023
1 parent a3ea447 commit 877dd52
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
Expand Down Expand Up @@ -90,19 +91,17 @@ public Cookie[] getCookies() {
if (headers != null) {
List<String> strCookies = headers.get("Cookie");
if (strCookies != null) {
Cookie[] cookies = new Cookie[strCookies.size()];
int i=0;
List<Cookie> cookies = new ArrayList<>();
for (String cookieString : strCookies) {
String[] tokens = cookieString.split("\\s*;\\s*");
for (String token : tokens) {
String[] keyVal = token.split("\\s*=\\s*");
if(keyVal.length==2){
cookies[i] = new Cookie(keyVal[0], keyVal[1]);
i++;
}
}
String[] tokens = cookieString.split("\\s*;\\s*");
for (String token : tokens) {
String[] keyVal = token.split("\\s*=\\s*");
if(keyVal.length == 2){
cookies.add(new Cookie(keyVal[0], keyVal[1]));
}
}
}
return cookies;
return cookies.toArray(new Cookie[0]);
}
}
return null;
Expand Down

0 comments on commit 877dd52

Please sign in to comment.