I forgot to say that I'm running on a snapshot build of canoo from a
month or so a go and this issue seems to be related to a recent
HtmlUnit 2.5 change - see
http://www.nabble.com/Htmlunit-v2.5-seems-to-have-broken-ability-to-set-specific-ACCEPT-header-for-a-request-td23455262.html
. I'm going to get my versions of both these to latest as there are
in hints in that thread towards a resolution.
Thanks,
Ian
On 24 Jun 2009, at 18:15, Ian Homer wrote:
> Hi,
>
> Is there anyway to override the accept header sent by canoo? It
> seems to always be set to */*
>
> I'm running the following test ...
>
> -TEST START-
>
> package com.bemoko.webtest.canoo
>
> import com.canoo.webtest.WebtestCase
>
> /**
> * Test how canoo deals with headers
> */
> class HeaderTest extends WebtestCase {
> void test() {
> webtest("HeaderTest") {
> config(host:"localhost",port:
> 80,basepath:"test",haltonfailure:false) {
> header name:"X-bemoko-test",value:"value1"
> header name:"accept",value:"text/css"
> }
> invoke "/context/request.html"
> verifyText "X-bemoko-test : value1"
> verifyText "accept : text/css"
> }
> }
> }
>
> -TEST END-
>
> where the requested page essentially dumps the request object with
> all the HTTP headers. In this case it returns ...
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "
http://www.wapforum.org/DTD/xhtml-mobile10.dtd
> "><html xmlns="
http://www.w3.org/1999/xhtml"><head><title>request
> test</title><link type="text/css" href="/test/context/../main.css"
> rel="stylesheet"/></head><body><div id="header">bemoko live <a
> href="/test/i">test suite</a></div><ul id="nav"><li><a href="/test/
> context/index.html">context</a></li><li><a href="/test/platform/
> index.html">platform</a></li></ul><h1>request test</h1><div
> id="wrapper"><div>Request Headers :<ul><li>x-bemoko-test : value1 </
> li><li>Accept-Language : en-us,en;q=0.5 </li><li>user-agent :
> NokiaE61i-1/3.0 (1.00.0633.15.00) SymbianOS/9.1 Series60/3.0 Profile/
> MIDP-2.0 Configuration/CLDC-1.1 </li><li>accept : */* </
> li><li>host : stage.bemoko.com </li><li>content-length : 0 </li></
> ul></div><div>Request Objects<ul><li>Server Name : stage.bemoko.com</
> li><li>Server Port : 80</li><li>Remote Host : 82.69.61.194</
> li><li>Remote Addr : 82.69.61.194</li></ul></div></div><ul
> id="breadcrumbs"><li><a href="/test/i">home</a></li></ul><div
> id="footer">© bemoko</div></body></html>
>
> You can see the user-agent and x-bemoko-test HTTP headers in this
> output, but for the accept header "*/*" is returned. This causes
> the ... verifyText "accept : text/css" ... step in the test to fail.
>
> Any ideas on how to get the accept header through, or is this a bug?
>
> Cheers,
>
> Ian
>
> --
>
ian.homer@...
>
http://bemoko.com |
http://twitter.com/ianhomer>
>
>
>
>
>
>
>
>
--
Ian Homer
mobile ... made simple
http://bemoko.com |
http://twitter.com/ianhomer_______________________________________________
WebTest mailing list
WebTest@...
http://lists.canoo.com/mailman/listinfo/webtest