jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kim Madsen <kim.mad...@inceptor.com>
Subject com.meterware.httpunit.WebResponse
Date Tue, 05 Mar 2002 15:35:17 GMT
I have found a problem when using 

public void endXXX(com.meterware.httpunit.WebResponse theResponse)

in a Cactus test case.

In my Servlet I do a
	response.setHeader("Content-Type", "text/html");

When I latter check it using com.meterware.httpunit.WebResponse I get an
assertion error because it says the header is "text/html, text/html":

Unexpected content type expected:<text/html> but was:<text/html,
text/html> 

junit.framework.AssertionFailedError: Unexpected content type
expected:<text/html> but was:<text/html, text/html>


However, if I use
public void endXXX(org.apache.cactus.WebResponse theResponse)

in my Cactus test case, the headers is "text/html" - as expected.

I do not know, if this is a Cactus bug or a Meterware bug.
Any advice?

The code is as follows:


    /* Bug in Cactus or Meterware?
     * Context header comes back as "text/html, text/html"
     * Where it was expected to be "text/html".
     */
    public void endServeResource(com.meterware.httpunit.WebResponse
theResponse) {

	try {
	    assertEquals("Unexpected content type",
			 "text/html",
			 theResponse.getHeaderField("Content-Type"));	    
	} catch (Exception e) {
	    fail(e);
	}
    }

    /* This works fine
     */
    public void endServeResource(org.apache.cactus.WebResponse
theResponse) {

	try {
	    java.net.HttpURLConnection connection = 
		theResponse.getConnection();

	    assertEquals("Unexpected content type",
			 "text/html", connection.getContentType());
	} catch (Exception e) {
	    fail(e);
	}
    }


Again this is not an urgent problem, as I already found the work arround
it.

Cheers, Kim

--
To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>


Mime
View raw message