SF.net SVN: htmlunit: [1250] trunk/htmlunit/src

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

SF.net SVN: htmlunit: [1250] trunk/htmlunit/src

mguillem
Revision: 1250
          http://svn.sourceforge.net/htmlunit/?rev=1250&view=rev
Author:   mguillem
Date:     2006-10-26 22:00:39 -0700 (Thu, 26 Oct 2006)

Log Message:
-----------
fixed closing quote in js generation

Modified Paths:
--------------
    trunk/htmlunit/src/java/com/gargoylesoftware/htmlunit/util/DebuggingWebConnection.java
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/util/DebuggingWebConnectionTest.java

Modified: trunk/htmlunit/src/java/com/gargoylesoftware/htmlunit/util/DebuggingWebConnection.java
===================================================================
--- trunk/htmlunit/src/java/com/gargoylesoftware/htmlunit/util/DebuggingWebConnection.java 2006-10-27 04:57:07 UTC (rev 1249)
+++ trunk/htmlunit/src/java/com/gargoylesoftware/htmlunit/util/DebuggingWebConnection.java 2006-10-27 05:00:39 UTC (rev 1250)
@@ -137,9 +137,9 @@
         buffer.append("fileName: '" + f.getName() + "', ");
         buffer.append("contentType: '" + response.getContentType() + "', ");
         buffer.append("method: '" + settings.getSubmitMethod().getName() + "', ");
-        buffer.append("url: '" + response.getUrl() + ",");
+        buffer.append("url: '" + response.getUrl() + "', ");
         buffer.append("headers: " + nameValueListToJsMap(response.getResponseHeaders()));
-        buffer.append("'};\n");
+        buffer.append("};\n");
         final FileWriter jsFileWriter = new FileWriter(javaScriptFile_, true);
         jsFileWriter.write(buffer.toString());
 
@@ -158,7 +158,7 @@
         final StringBuffer buffer = new StringBuffer("{");
         for (final Iterator iter=headers.iterator(); iter.hasNext();) {
             final NameValuePair header = (NameValuePair) iter.next();
-            buffer.append("\"" + header.getName() + "\": \"" + header.getValue() + "\", ");
+            buffer.append("'" + header.getName() + "': '" + header.getValue().replaceAll("'", "\\'") + "', ");
         }
         buffer.delete(buffer.length()-2, buffer.length());
         buffer.append("}");

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/util/DebuggingWebConnectionTest.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/util/DebuggingWebConnectionTest.java 2006-10-27 04:57:07 UTC (rev 1249)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/util/DebuggingWebConnectionTest.java 2006-10-27 05:00:39 UTC (rev 1250)
@@ -69,18 +69,18 @@
         assertEquals("{}", DebuggingWebConnection.nameValueListToJsMap(Collections.EMPTY_LIST));
 
         List list = Collections.singletonList(new NameValuePair("name", "value"));
-        assertEquals("{\"name\": \"value\"}",
+        assertEquals("{'name': 'value'}",
                 DebuggingWebConnection.nameValueListToJsMap(list));
 
         list = Collections.singletonList(new NameValuePair("na me", "value"));
-        assertEquals("{\"na me\": \"value\"}",
+        assertEquals("{'na me': 'value'}",
                 DebuggingWebConnection.nameValueListToJsMap(list));
 
         list = new ArrayList();
         list.add(new NameValuePair("na me", "value1"));
         list.add(new NameValuePair("key", "value 2"));
         list.add(new NameValuePair("key 2", "value 3"));
-        final String expected = "{'na me': 'value1', 'key': 'value 2', 'key 2': 'value 3'}".replaceAll("'", "\"");
+        final String expected = "{'na me': 'value1', 'key': 'value 2', 'key 2': 'value 3'}";
         assertEquals(expected, DebuggingWebConnection.nameValueListToJsMap(list));
     }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop