#191 Allow PostMethodWebRequest handle non form requests (patch)


I have been using httpunit for quite a while to test my servlets. These servlets deal with binary data and have nothing to do with HTML. One thing that I have always had to work around is that PostMethodWebRequest does not encode the request parameters in the URL query string.

I understand why PostMethodWebRequest does this, it's so that it complies with the HTML 4.01 standard, section 17.13 Form Submission http://www.w3.org/TR/html4/interact/forms.html#submit-format.

However, when interacting with servlets that do not handle HTML it would be convenient if I could tell PostMethodWebRequest that it is not dealing with HTML form data and so it can then encode the request parameters in the URL query string.

Please find a patch attached that makes this possible. This applies to the trunk of httpunit as of 2011-04-09.


  • Warwick Hunter

    Warwick Hunter - 2011-04-12
    • summary: Allow PostMethodWebRequest to handle non html form requests --> Allow PostMethodWebRequest handle non form requests (patch)
  • Wolfgang Fahl

    Wolfgang Fahl - 2012-09-13

    Dear httpunit user!

    Thank you for your feature request. We appreciate the time and effort you are putting into this.

    Please supply a testcase with the expected result for the feature you are asking for and we'll look into implementing it. For a start you might want to get the trunk version from the
    subversion repository (see https://sourceforge.net/svn/?group_id=6550\)
    and have a look at the source code of some of the more than 700 JUnit based testcase in there.

    When you are ready you might want to attach the testcase (and if you already have started implementing it also the actual code) to your feature request.

    This should give you a clue on what a proper testcase for httpunit looks like. The main communication about further details of the development is via the httpunit developer mailinglist. You are most welcome to sign up via

    The httpunit developer team

    (Russell and Wolfgang as of 2008-03)

  • Wolfgang Fahl

    Wolfgang Fahl - 2012-09-13

    Dear Warwick,

    we are currently in the process of preparing 1.7.2 and it would be great to add your feature.
    There has been another Request/Report I have been working on today that was about the Content-type handling. Would it be possible to change the behaviour based on content type?

    Or would we need some kind of options? Currently there is HttpUnit Options and ClientProperties - i don't think we have options for Servlets yet. I think it is worthwhile to discuss the issue on the httpunit developer mailing list.


  • Wolfgang Fahl

    Wolfgang Fahl - 2012-09-13
    • assigned_to: nobody --> wolfgang_fahl
    • status: open --> pending
  • Warwick Hunter

    Warwick Hunter - 2012-09-15
    • status: pending --> open
  • Warwick Hunter

    Warwick Hunter - 2012-09-15

    Wolfgang, thanks for considering my feature request.

    In my case I use HttpUnit to test servlets that receive binary data and respond with binary data. The binary data can be a custom one such as application/x-mycompany-something or some sort of Google Protocol Buffer application/x-protobuf;proto=something.

    I think trying to switch this behaviour based on the content type might be hard to get right. Which content types would have the form data handling and which would not?

    I like the idea of a new set of servlet options, similar to those for HttpUnit and ClientProperties.


  • Paulo "JCranky" Siqueira

    This never got in?

  • Warwick Hunter

    Warwick Hunter - 2014-07-22

    Not to my knowledge. I believe that it has not been integrated.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks