From: Vasudevan C. <vco...@gm...> - 2018-12-04 15:11:52
|
Hi Ronald, Did some comparison between 2.23 codebase & 2.33 codebase. I modified the 2.33 codebase in WebClient.java and the method addDefaultheaders which is copied below. I saw the Accept header value was getting set with what I gave. The fix I put may not be the right one. Let me know your thoughts. Regards Vasu ************************************************** private void addDefaultHeaders(final WebRequest wrs) { // Add standard HtmlUnit headers. if (!wrs.isAdditionalHeader(HttpHeader.ACCEPT_LANGUAGE)) { wrs.setAdditionalHeader(HttpHeader.ACCEPT_LANGUAGE, getBrowserVersion().getBrowserLanguage()); } if (getBrowserVersion().hasFeature(HTTP_HEADER_UPGRADE_INSECURE_REQUEST) && !wrs.isAdditionalHeader(HttpHeader.UPGRADE_INSECURE_REQUESTS)) { wrs.setAdditionalHeader(HttpHeader.UPGRADE_INSECURE_REQUESTS, "1"); } // Add user-specified headers last so that they can override HtmlUnit defaults. // requestHeaders_.forEach((name, value) -> { // if (!wrs.isAdditionalHeader(name)) { // wrs.setAdditionalHeader(name, value); // } // }); wrs.getAdditionalHeaders().putAll(requestHeaders_); } ******************************************************* On Mon, 3 Dec 2018 at 22:51, Ronald Brill <rb...@rb...> wrote: > Hi Vasu, > > do you have some sample code for me. Will then try to reproduce (and fix) > > RBRi > > On Mon, 3 Dec 2018 20:14:50 +0530 Vasudevan Comandur wrote: > > > >All, > > > > I was trying to migrate my app from htmlunit 2.23 to htmlunit 2.33. > > > > As part of the app, I was setting the "Accept" using addRequestHeader > >method > > to "application/pdf". The header was not getting set. > > > > I am setting the Browser_Version to FIREFOX_60. > > > > The same call was working fine in 2.23. Am I missing something?. > > > > Looking forward to hearing from you. > > > >Regards > > Vasu > > > > > > > >----< Inline text [text-plain-04.txt] >------------------ > > > > > > > > > >----< Inline text [text-plain-05.txt] >------------------ > > > >_______________________________________________ > >Htmlunit-user mailing list > >Htm...@li... > >https://lists.sourceforge.net/lists/listinfo/htmlunit-user > > > > > > |