From: Mike B. <mb...@Ga...> - 2004-01-16 11:23:50
|
Chris Pudney wrote: > I would like a simple example of how to set a cookie in the WebClient > request header. I've tried the obvious: > > web_client.addRequestHeader("Cookie", COOKIE); > page = (HtmlPage) web_client.getPage("http://localhost/cgi-bin/printenv"); I would have expected that to work but perhaps common-httpclient is stripping that header out. There is no explicit way to set cookies in HtmlUnit at present. There is aleady a feature request to expose the underlying instance of common-httpclient which would solve this (and several other) problems. Unfortunately, this isn't a simple change and I haven't had time to work on it. If anyone else want's to tackle the issue of exposing commons-httpclient, I can explain what makes it a complex problem and what I think is the best solution. -- Mike Bowler Principal, Gargoyle Software Inc. Voice: (416) 822-0973 | Email : mb...@Ga... Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com |