@@ -26,17 +26,28 @@ public void testToJsonObject_Request()
2626 {
2727 jsonobject = HTTP
2828 .toJSONObject ("GET / HTTP/1.0\n Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*\n Accept-Language: en-us\n User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90; T312461; Q312461)\n Host: www.nokko.com\n Connection: keep-alive\n Accept-encoding: gzip, deflate\n " );
29+ //"{\n \"Accept-Language\": \"en-us\",\n \"Request-URI\": \"/\",\n \"Host\": \"www.nokko.com\",\n \"Method\": \"GET\",\n \"Accept-encoding\": \"gzip, deflate\",\n \"User-Agent\": \"Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90; T312461; Q312461)\",\n \"HTTP-Version\": \"HTTP/1.0\",\n \"Connection\": \"keep-alive\",\n \"Accept\": \"image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*\"\n}"
2930 assertEquals (
30- "{\n \" Accept-Language\" : \" en-us\" ,\n \" Request-URI\" : \" /\" ,\n \" Host\" : \" www.nokko.com\" ,\n \" Method\" : \" GET\" ,\n \" Accept-encoding\" : \" gzip, deflate\" ,\n \" User-Agent\" : \" Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90; T312461; Q312461)\" ,\n \" HTTP-Version\" : \" HTTP/1.0\" ,\n \" Connection\" : \" keep-alive\" ,\n \" Accept\" : \" image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*\" \n }" ,
31+ "{\n " +
32+ " \" Method\" : \" GET\" ,\n " +
33+ " \" Request-URI\" : \" /\" ,\n " +
34+ " \" HTTP-Version\" : \" HTTP/1.0\" ,\n " +
35+ " \" Accept\" : \" image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */*\" ,\n " +
36+ " \" Accept-Language\" : \" en-us\" ,\n " +
37+ " \" User-Agent\" : \" Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90; T312461; Q312461)\" ,\n " +
38+ " \" Host\" : \" www.nokko.com\" ,\n " +
39+ " \" Connection\" : \" keep-alive\" ,\n " +
40+ " \" Accept-encoding\" : \" gzip, deflate\" \n " +
41+ "}" ,
3142 jsonobject .toString (2 ));
3243 assertEquals (
33- "GET \" /\" HTTP/1.0\r \n "
34- + "Accept-Language: en-us \r \n "
35- + "Host: www.nokko.com \r \n "
36- + "Accept-encoding: gzip, deflate \r \n "
37- + "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90; T312461; Q312461) \r \n "
38- + "Connection: keep-alive\r \n "
39- + "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */* \r \n \r \n " ,
44+ "GET \" /\" HTTP/1.0\r \n " +
45+ "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, */* \r \n " +
46+ "Accept-Language: en-us \r \n " +
47+ "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90; T312461; Q312461) \r \n " +
48+ "Host: www.nokko.com \r \n " +
49+ "Connection: keep-alive\r \n " +
50+ "Accept-encoding: gzip, deflate \r \n \r \n " ,
4051 HTTP .toString (jsonobject ));
4152
4253 } catch (Exception e )
@@ -54,16 +65,27 @@ public void testToJsonObject_Response()
5465 {
5566 jsonobject = HTTP
5667 .toJSONObject ("HTTP/1.1 200 Oki Doki\n Date: Sun, 26 May 2002 17:38:52 GMT\n Server: Apache/1.3.23 (Unix) mod_perl/1.26\n Keep-Alive: timeout=15, max=100\n Connection: Keep-Alive\n Transfer-Encoding: chunked\n Content-Type: text/html\n " );
68+ //"{\n \"Reason-Phrase\": \"Oki Doki\",\n \"Status-Code\": \"200\",\n \"Transfer-Encoding\": \"chunked\",\n \"Date\": \"Sun, 26 May 2002 17:38:52 GMT\",\n \"Keep-Alive\": \"timeout=15, max=100\",\n \"HTTP-Version\": \"HTTP/1.1\",\n \"Content-Type\": \"text/html\",\n \"Connection\": \"Keep-Alive\",\n \"Server\": \"Apache/1.3.23 (Unix) mod_perl/1.26\"\n}"
5769 assertEquals (
58- "{\n \" Reason-Phrase\" : \" Oki Doki\" ,\n \" Status-Code\" : \" 200\" ,\n \" Transfer-Encoding\" : \" chunked\" ,\n \" Date\" : \" Sun, 26 May 2002 17:38:52 GMT\" ,\n \" Keep-Alive\" : \" timeout=15, max=100\" ,\n \" HTTP-Version\" : \" HTTP/1.1\" ,\n \" Content-Type\" : \" text/html\" ,\n \" Connection\" : \" Keep-Alive\" ,\n \" Server\" : \" Apache/1.3.23 (Unix) mod_perl/1.26\" \n }" ,
70+ "{\n " +
71+ " \" HTTP-Version\" : \" HTTP/1.1\" ,\n " +
72+ " \" Status-Code\" : \" 200\" ,\n " +
73+ " \" Reason-Phrase\" : \" Oki Doki\" ,\n " +
74+ " \" Date\" : \" Sun, 26 May 2002 17:38:52 GMT\" ,\n " +
75+ " \" Server\" : \" Apache/1.3.23 (Unix) mod_perl/1.26\" ,\n " +
76+ " \" Keep-Alive\" : \" timeout=15, max=100\" ,\n " +
77+ " \" Connection\" : \" Keep-Alive\" ,\n " +
78+ " \" Transfer-Encoding\" : \" chunked\" ,\n " +
79+ " \" Content-Type\" : \" text/html\" \n " +
80+ "}" ,
5981 jsonobject .toString (2 ));
60- assertEquals ("HTTP/1.1 200 Oki Doki\r \n "
61- + "Transfer-Encoding: chunked \r \n "
62- + "Date: Sun, 26 May 2002 17:38:52 GMT \r \n "
63- + "Keep-Alive: timeout=15, max=100\r \n "
64- + "Content-Type: text/html \r \n "
65- + "Connection: Keep-Alive \r \n "
66- + "Server: Apache/1.3.23 (Unix) mod_perl/1.26 \r \n \r \n " ,
82+ assertEquals ("HTTP/1.1 200 Oki Doki\r \n " +
83+ "Date: Sun, 26 May 2002 17:38:52 GMT \r \n " +
84+ "Server: Apache/1.3.23 (Unix) mod_perl/1.26 \r \n " +
85+ "Keep-Alive: timeout=15, max=100\r \n " +
86+ "Connection: Keep-Alive \r \n " +
87+ "Transfer-Encoding: chunked \r \n " +
88+ "Content-Type: text/html \r \n \r \n " ,
6789 HTTP .toString (jsonobject ));
6890 } catch (Exception e )
6991 {
@@ -80,7 +102,14 @@ public void testToString_NullKey()
80102 {
81103 jsonobject = new JSONObject ("{\n \" Reason-Phrase\" : \" Oki Doki\" ,\n \" Status-Code\" : \" 200\" ,\n \" Transfer-Encoding\" : \" chunked\" ,\n \" Date\" : \" Sun, 26 May 2002 17:38:52 GMT\" ,\n \" Keep-Alive\" : \" timeout=15, max=100\" ,\n \" HTTP-Version\" : \" HTTP/1.1\" ,\n \" Content-Type\" : \" text/html\" ,\n \" Connection\" : \" Keep-Alive\" ,\n \" Server\" : \" Apache/1.3.23 (Unix) mod_perl/1.26\" \n }" );
82104 jsonobject .put ("testKey" , JSONObject .NULL );
83- assertEquals ("HTTP/1.1 200 Oki Doki\r \n Date: Sun, 26 May 2002 17:38:52 GMT\r \n Transfer-Encoding: chunked\r \n Keep-Alive: timeout=15, max=100\r \n Connection: Keep-Alive\r \n Content-Type: text/html\r \n Server: Apache/1.3.23 (Unix) mod_perl/1.26\r \n \r \n " , HTTP .toString (jsonobject ));
105+ //"HTTP/1.1 200 Oki Doki\r\nDate: Sun, 26 May 2002 17:38:52 GMT\r\nTransfer-Encoding: chunked\r\nKeep-Alive: timeout=15, max=100\r\nConnection: Keep-Alive\r\nContent-Type: text/html\r\nServer: Apache/1.3.23 (Unix) mod_perl/1.26\r\n\r\n"
106+ assertEquals ("HTTP/1.1 200 Oki Doki\r \n " +
107+ "Transfer-Encoding: chunked\r \n " +
108+ "Date: Sun, 26 May 2002 17:38:52 GMT\r \n " +
109+ "Keep-Alive: timeout=15, max=100\r \n " +
110+ "Content-Type: text/html\r \n " +
111+ "Connection: Keep-Alive\r \n " +
112+ "Server: Apache/1.3.23 (Unix) mod_perl/1.26\r \n \r \n " , HTTP .toString (jsonobject ));
84113 } catch (Exception e )
85114 {
86115 fail (e .toString ());
0 commit comments