changeset 753:a4952d5ec439

HttpContentDecodingFilter, HttpVarsFilter improvements
author Devel 2
date Wed, 13 Dec 2017 12:34:36 +0100
parents ca40a354ee98
children 66fe741beb94
files stress-tester/src/main/java/com/passus/st/client/http/filter/HttpContentDecodingFilter.java stress-tester/src/main/java/com/passus/st/vars/HttpVarsFilter.java
diffstat 2 files changed, 30 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpContentDecodingFilter.java	Wed Dec 13 12:33:49 2017 +0100
+++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpContentDecodingFilter.java	Wed Dec 13 12:34:36 2017 +0100
@@ -18,7 +18,11 @@
 
     private final HttpMessageHelper helper = HttpMessageHelper.get();
 
-    private void encodeMessageContent(HttpMessage msg) {
+    private boolean decodeRequest = true;
+
+    private boolean decodeResponse = false;
+
+    private void decodeMessageContent(HttpMessage msg) {
         if (msg == null) {
             return;
         }
@@ -32,9 +36,32 @@
         }
     }
 
+    public boolean isDecodeRequest() {
+        return decodeRequest;
+    }
+
+    public void setDecodeRequest(boolean decodeRequest) {
+        this.decodeRequest = decodeRequest;
+    }
+
+    public boolean isDecodeResponse() {
+        return decodeResponse;
+    }
+
+    public void setDecodeResponse(boolean decodeResponse) {
+        this.decodeResponse = decodeResponse;
+    }
+
     @Override
     public int filterOutbound(HttpRequest req, HttpResponse resp, HttpFlowContext context) {
-        encodeMessageContent(req);
+        if (decodeRequest) {
+            decodeMessageContent(req);
+        }
+
+        if (decodeResponse) {
+            decodeMessageContent(resp);
+        }
+        
         return DUNNO;
     }
 
--- a/stress-tester/src/main/java/com/passus/st/vars/HttpVarsFilter.java	Wed Dec 13 12:33:49 2017 +0100
+++ b/stress-tester/src/main/java/com/passus/st/vars/HttpVarsFilter.java	Wed Dec 13 12:34:36 2017 +0100
@@ -50,7 +50,7 @@
         //Przetwarzamy tylko requesty, response'a nie ma sensu
         if (req != null) {
             try {
-                //Zakladamy, ze kontent jest zdekodowany
+                helper.decodeContent(req, true);
                 ByteBuff buffer = req.getContentByteBuff();
                 if (buffer != null) {
                     List<Var> vars = compiler.search(buffer);