|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Htmlunit v2.5 seems to have broken ability to set specific ACCEPT header for a requestI have been using htmlunit v2.4 to test my web service. I needed the ability to set specific ACCEPT headers in the request to my service, and htmlunit provided me with a way of doing this - I simply called the addRequestHeader method on my WebClient. For example, to set the request header to XML, I did: ... WebClient myClient = new WebClient(BrowserVersion.FIREFOX_3); myClient.addRequestHeader("ACCEPT", "text/xml, application/xml"); ... This worked just as I expected and my we service handled the request correctly. However, I tried the latest version of htmlunit today (v.5) only to find that it now always puts in a default ACCEPT header of "*/*". htmlunit v2.4 set the following request headers: {ACCEPT=text/xml, application/xml} where as v2.5 is setting them to: {Accept-Language=en, ACCEPT=text/xml, application/xml, Accept=*/*} I looked at the change logs for v2.5 and think that this change in behavior was probably introduced by the following issue: "Add default value for "Accept" and "Accept-Language" HTTP headers. Fixes 2602044" This is breaking my tests and I was wondering if there was any way of disabling this feature (i.e. stop it from adding in a default ACCEPT header or having a way of resetting it completely)? Any guidance would be greatly appreciated. Cheers, Anjum. Share your photos with Windows Live Photos – Free. Try it Now! ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ Htmlunit-user mailing list Htmlunit-user@... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |
|
|
Re: Htmlunit v2.5 seems to have broken ability to set specific ACCEPT header for a requestHi Anjum,
You should add the header value as 'Accept', not 'ACCEPT'. In this case, you will override the default '*/*' value.
I guess that headers case sensitivity is the main issue here, please raise RFE..
Yours,
Ahmed ----Blog: http://asashour.blogspot.com From: Anjum Naseer <tpanjum@...> To: htmlunit-user@... Sent: Saturday, May 9, 2009 2:25:27 AM Subject: [Htmlunit-user] Htmlunit v2.5 seems to have broken ability to set specific ACCEPT header for a request Hi, I have been using htmlunit v2.4 to test my web service. I needed the ability to set specific ACCEPT headers in the request to my service, and htmlunit provided me with a way of doing this - I simply called the addRequestHeader method on my WebClient. For example, to set the request header to XML, I did: ... WebClient myClient = new WebClient(BrowserVersion.FIREFOX_3); myClient.addRequestHeader("ACCEPT", "text/xml, application/xml"); ... This worked just as I expected and my we service handled the request correctly. However, I tried the latest version of htmlunit today (v.5) only to find that it now always puts in a default ACCEPT header of "*/*". htmlunit v2.4 set the following request headers: {ACCEPT=text/xml, application/xml} where as v2.5 is setting them to: {Accept-Language=en, ACCEPT=text/xml, application/xml, Accept=*/*} I looked at the change logs for v2.5 and think that this change in behavior was probably introduced by the following issue: "Add default value for "Accept" and "Accept-Language" HTTP headers. Fixes 2602044" This is breaking my tests and I was wondering if there was any way of disabling this feature (i.e. stop it from adding in a default ACCEPT header or having a way of resetting it completely)? Any guidance would be greatly appreciated. Cheers, Anjum. Share your photos with Windows Live Photos – Free. Try it Now! ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ Htmlunit-user mailing list Htmlunit-user@... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |