[prev in list] [next in list] [prev in thread] [next in thread] 

List:       htmlunit-develop
Subject:    [HtmlUnit] SF.net SVN: htmlunit:[5744] trunk/htmlunit/src
From:       asashour () users ! sourceforge ! net
Date:       2010-05-28 11:41:53
Message-ID: E1OHxwn-00021s-MH () sfp-svn-4 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 5744
          http://htmlunit.svn.sourceforge.net/htmlunit/?rev=5744&view=rev
Author:   asashour
Date:     2010-05-28 11:41:53 +0000 (Fri, 28 May 2010)

Log Message:
-----------
Fixing build, thanks to Marc for pointing out the regression.

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java
  trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Dojo102Test.java


Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java
 ===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java	2010-05-28 \
                10:41:26 UTC (rev 5743)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java	2010-05-28 \
11:41:53 UTC (rev 5744) @@ -221,17 +221,20 @@
 
             if (webRequest.getEncodingType() == FormEncodingType.URL_ENCODED && \
method instanceof HttpPost) {  final HttpPost postMethod = (HttpPost) method;
-                final List<NameValuePair> pairs = webRequest.getRequestParameters();
-                final org.apache.http.NameValuePair[] httpClientPairs = \
                NameValuePair.toHttpClient(pairs);
-                final String query = \
                URLEncodedUtils.format(Arrays.asList(httpClientPairs), charset);
-                final URI uri =
-                    URIUtils.createURI(url.getProtocol(), url.getHost(), \
                url.getPort(), url.getPath(), query, null);
-                postMethod.setURI(uri);
-
-                final String body = \
                StringUtils.defaultString(webRequest.getRequestBody());
-                final StringEntity urlEncodedEntity = new StringEntity(body, \
                charset);
-                urlEncodedEntity.setContentType(URLEncodedUtils.CONTENT_TYPE);
-                postMethod.setEntity(urlEncodedEntity);
+                if (webRequest.getRequestBody() == null) {
+                    final List<NameValuePair> pairs = \
webRequest.getRequestParameters(); +                    final \
org.apache.http.NameValuePair[] httpClientPairs = NameValuePair.toHttpClient(pairs); \
+                    final String query = \
URLEncodedUtils.format(Arrays.asList(httpClientPairs), charset); +                    \
final StringEntity urlEncodedEntity = new StringEntity(query, charset); +             \
urlEncodedEntity.setContentType(URLEncodedUtils.CONTENT_TYPE); +                    \
postMethod.setEntity(urlEncodedEntity); +                }
+                else {
+                    final String body = \
StringUtils.defaultString(webRequest.getRequestBody()); +                    final \
StringEntity urlEncodedEntity = new StringEntity(body, charset); +                    \
urlEncodedEntity.setContentType(URLEncodedUtils.CONTENT_TYPE); +                    \
postMethod.setEntity(urlEncodedEntity); +                }
             }
             else if (FormEncodingType.MULTIPART == webRequest.getEncodingType()) {
                 final MultipartEntity multipartEntity =

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java
 ===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java	2010-05-28 \
                10:41:26 UTC (rev 5743)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/HttpWebConnection2Test.java	2010-05-28 \
11:41:53 UTC (rev 5744) @@ -25,6 +25,8 @@
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebDriver;
 
+import com.gargoylesoftware.htmlunit.util.NameValuePair;
+
 /**
  * Tests methods in {@link HttpWebConnection}.
  *
@@ -68,7 +70,16 @@
         assertEquals(FormEncodingType.URL_ENCODED, lastRequest.getEncodingType());
         assertEquals(HttpMethod.POST, lastRequest.getHttpMethod());
         assertEquals(0, lastRequest.getProxyPort());
-        assertEquals("[text1=me &amp; you, text2=Hello\r\nworld!]", \
lastRequest.getRequestParameters().toString()); +        final List<NameValuePair> \
parameters = lastRequest.getRequestParameters(); +        assertEquals(2, \
parameters.size()); +        for (final NameValuePair pair : parameters) {
+            if (pair.getName().equals("text1")) {
+                assertEquals("me &amp; you", pair.getValue());
+            }
+            else {
+                assertEquals("Hello\r\nworld!", pair.getValue());
+            }
+        }
     }
 
     private String headersToString(final WebRequest request) {

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Dojo102Test.java
 ===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Dojo102Test.java	2010-05-28 \
                10:41:26 UTC (rev 5743)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/libraries/Dojo102Test.java	2010-05-28 \
11:41:53 UTC (rev 5744) @@ -58,7 +58,7 @@
      * @throws Exception if an error occurs
      */
     @Test
-    @Reries(5)
+    @Reries(3)
     public void dojo() throws Exception {
         client_ = new WebClient(BrowserVersion.FIREFOX_3);
         final String url = "http://localhost:" + PORT + "/util/doh/runner.html";


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

------------------------------------------------------------------------------

_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic