Skip to content

Commit

Permalink
improve code in prev commit #2165
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrthomas committed Nov 2, 2022
1 parent 41c9da9 commit c97d89f
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import com.intuit.karate.core.Config;
import com.intuit.karate.core.ScenarioEngine;
import io.netty.handler.codec.http.cookie.ClientCookieDecoder;
import io.netty.handler.codec.http.cookie.ServerCookieDecoder;
import io.netty.handler.codec.http.cookie.ServerCookieEncoder;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -296,17 +295,17 @@ public Response invoke(HttpRequest request) {
// edge case where the apache client
// auto-followed a redirect where cookies were involved
List<String> mergedCookieValues = new ArrayList(requestCookieHeaders.length);
Set<String> cookieNames = new HashSet(requestCookieHeaders.length);
Set<String> alreadyMerged = new HashSet(requestCookieHeaders.length);
for (Header ch : requestCookieHeaders) {
String requestCookieValue = ch.getValue();
io.netty.handler.codec.http.cookie.Cookie c = ClientCookieDecoder.LAX.decode(requestCookieValue);
cookieNames.add(c.name());
io.netty.handler.codec.http.cookie.Cookie c = ClientCookieDecoder.LAX.decode(requestCookieValue);
mergedCookieValues.add(requestCookieValue);
alreadyMerged.add(c.name());
}
for (Cookie c : storedCookies) {
if (c.getValue() != null) {
String name = c.getName();
if (cookieNames.contains(name)) {
if (alreadyMerged.contains(name)) {
continue;
}
Map<String, Object> map = new HashMap();
Expand Down

0 comments on commit c97d89f

Please sign in to comment.