Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2014-10-02 18:12:32 -0400
committerJoakim Erdfelt2014-10-02 18:12:32 -0400
commit61dd2c962096b698b72ca7ea30de6147470205ec (patch)
treeb6f523983c5fb526cb7b6503c3aa855f40e8cee9 /jetty-server
parent43d2c5939475a2b35e25acf4a837f9293968f0f9 (diff)
downloadorg.eclipse.jetty.project-61dd2c962096b698b72ca7ea30de6147470205ec.tar.gz
org.eclipse.jetty.project-61dd2c962096b698b72ca7ea30de6147470205ec.tar.xz
org.eclipse.jetty.project-61dd2c962096b698b72ca7ea30de6147470205ec.zip
Fixing encoding tests (that actually didn't validate results)
Diffstat (limited to 'jetty-server')
-rw-r--r--jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java
index ef8025c70e..b4feb2f8bc 100644
--- a/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java
+++ b/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java
@@ -590,8 +590,11 @@ public class RequestTest
@Override
public boolean check(HttpServletRequest request,HttpServletResponse response) throws IOException
{
+ // Should be "testä"
+ // "test" followed by a LATIN SMALL LETTER A WITH DIAERESIS
request.setCharacterEncoding(StringUtil.__ISO_8859_1);
- return "test\u00e4".equals(request.getParameter("name2"));
+ String actual = request.getParameter("name2");
+ return "test\u00e4".equals(actual);
}
};
@@ -604,7 +607,8 @@ public class RequestTest
"Connection: close\r\n"+
"\r\n"+
content;
- _connector.getResponses(request);
+ String response = _connector.getResponses(request);
+ assertThat(response,Matchers.containsString(" 200 OK"));
}
@Test
@@ -615,11 +619,15 @@ public class RequestTest
@Override
public boolean check(HttpServletRequest request,HttpServletResponse response) throws IOException
{
- return "test\u00e4".equals(request.getParameter("name2"));
+ // http://www.ltg.ed.ac.uk/~richard/utf-8.cgi?input=00e4&mode=hex
+ // Should be "testä"
+ // "test" followed by a LATIN SMALL LETTER A WITH DIAERESIS
+ String actual = request.getParameter("name2");
+ return "test\u00e4".equals(actual);
}
};
- String content="name1=test&name2=test%C4%A4&name3=&name4=test";
+ String content="name1=test&name2=test%C3%A4&name3=&name4=test";
String request="POST / HTTP/1.1\r\n"+
"Host: whatever\r\n"+
"Content-Type: "+MimeTypes.Type.FORM_ENCODED.asString()+"\r\n" +
@@ -627,7 +635,8 @@ public class RequestTest
"Connection: close\r\n"+
"\r\n"+
content;
- _connector.getResponses(request);
+ String response = _connector.getResponses(request);
+ assertThat(response,Matchers.containsString(" 200 OK"));
}
@@ -748,6 +757,8 @@ public class RequestTest
"Host: myhost\n"+
"Connection: close\n"+
"\n");
+ assertThat(response,Matchers.containsString(" 302 Found"));
+ assertThat(response,Matchers.containsString("Location: http://myhost/foo"));
}
@Test
@@ -1213,6 +1224,7 @@ public class RequestTest
private class RequestHandler extends AbstractHandler
{
private RequestTester _checker;
+ @SuppressWarnings("unused")
private String _content;
@Override

Back to the top