changeset 449:dbc7a42e5db3

HttpSessionCookieFilter - bugfix
author Devel 1
date Mon, 31 Jul 2017 14:32:04 +0200
parents a9323277e4d4
children 3d993ed9ae3a
files stress-tester/src/main/java/com/passus/st/client/http/filter/HttpCsrfFilter.java stress-tester/src/main/java/com/passus/st/client/http/filter/HttpSessionCookieFilter.java
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpCsrfFilter.java	Mon Jul 31 12:12:23 2017 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpCsrfFilter.java	Mon Jul 31 14:32:04 2017 +0200
@@ -28,10 +28,6 @@
 import java.util.Queue;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
-import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef;
-import static com.passus.config.schema.ConfigurationSchemaBuilder.valueDef;
-import static com.passus.config.schema.ConfigurationSchemaBuilder.mapDef;
-import static com.passus.config.schema.ConfigurationSchemaBuilder.valueDef;
 
 /**
  *
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpSessionCookieFilter.java	Mon Jul 31 12:12:23 2017 +0200
+++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpSessionCookieFilter.java	Mon Jul 31 14:32:04 2017 +0200
@@ -147,9 +147,10 @@
         } else if (requestCookie != null) {
             makeMappingTagsAndSession(modifiedRequest, realResponse, context, requestCookie);
         } else {
-            String sessionId = (String) modifiedRequest.getTag(TAG_SESSION_ID);
+            Object sessionId = modifiedRequest.getTag(TAG_SESSION_ID);
             if (sessionId != null) {
                 realResponse.setTag(TAG_SESSION_ID, sessionId);
+                LOGGER.debug("Tagging real response with {}", sessionId);
             }
         }
 
@@ -178,6 +179,13 @@
             ParametersBag session = context.scopes().createSession(liveSessionId);
             session.set(TAG_ORIG_SESSION_ID, keyValue);
             LOGGER.debug("Mapping created: {} -> {} [{}]", keyValue, liveValue, modifiedRequest.getUrl());
+        } else {
+            // TODO: refactor
+            Object sessionId = modifiedRequest.getTag(TAG_SESSION_ID);
+            if (sessionId != null) {
+                realResponse.setTag(TAG_SESSION_ID, sessionId);
+                LOGGER.debug("Tagging real response with {}", sessionId);
+            }
         }
     }