Mercurial > stress-tester
changeset 880:a900c4082ff7
HttpVarsFilter - bugfix
author | Devel 1 |
---|---|
date | Mon, 05 Feb 2018 11:16:22 +0100 |
parents | 19a3babec5c5 |
children | 209eea24eef2 |
files | stress-tester/src/main/java/com/passus/st/client/http/filter/HttpVarsFilter.java stress-tester/src/test/java/com/passus/st/client/http/filter/HttpVarsFilterTest.java |
diffstat | 2 files changed, 9 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpVarsFilter.java Fri Feb 02 15:39:22 2018 +0100 +++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpVarsFilter.java Mon Feb 05 11:16:22 2018 +0100 @@ -65,9 +65,11 @@ List<Var> vars = compiler.search(buffer); if (vars != null && !vars.isEmpty()) { ByteBuff result = new HeapByteBuff(buffer.readableBytes()); - executor.execute(buffer, result, vars, new HttpMessageWrapper(req, resp, context)); - req.setContent(new ByteBuffDataSource(result)); - HttpMessageHelper.get().setContentLength(req, result.readableBytes()); + boolean changed = executor.execute(buffer, result, vars, new HttpMessageWrapper(req, resp, context)); + if (changed) { + req.setContent(new ByteBuffDataSource(result)); + HttpMessageHelper.get().setContentLength(req, result.readableBytes()); + } } } } catch (IOException e) {
--- a/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpVarsFilterTest.java Fri Feb 02 15:39:22 2018 +0100 +++ b/stress-tester/src/test/java/com/passus/st/client/http/filter/HttpVarsFilterTest.java Mon Feb 05 11:16:22 2018 +0100 @@ -100,8 +100,8 @@ assertEquals("x", content(parts.get(2), UTF_8)); } - @Test(enabled = false) - public void testEncodeInvalidMultipart() throws IOException { + @Test + public void testPostMultipart_unresolved() throws IOException { String hdrs = "POST /event_processing/edit/53ba69fcc2364828037a6bd7 HTTP/1.1\r\n" + "Host: 172.16.60.159\r\n" @@ -131,19 +131,11 @@ HttpVarsFilter filter = new HttpVarsFilter(appVars); filter.filterOutbound(request, null, null); -// HeapByteBuff buffff = new HeapByteBuff(); -// HttpRequestEncoder encoder = new HttpRequestEncoder(); -// encoder.encode(request, buffff); -// String sssssssss = buffff.toString(); -// System.out.println("----------------"); -// System.out.println(sssssssss); -// System.out.println("----------------"); - parts = HttpMessageHelper.get().decodeMultipart(request); assertEquals(3, parts.size()); - assertEquals("Filter X", content(parts.get(0), UTF_8)); + assertEquals("Filter {@name}", content(parts.get(0), UTF_8)); assertTrue(content(parts.get(1), UTF_8).contains("korzystajÄ…ce")); - assertEquals("x", content(parts.get(2), UTF_8)); + assertEquals("{@type}", content(parts.get(2), UTF_8)); } @Test