Setting Accept-Language header with ClientFacade
by pieter.kuijpers@luminis.nl
I'm testing a JSF application that has support for internationalization. Pages are rendered in the correct language based on the Accept-Language header in a request.
I can set the Accept-Language header in a unit test by invoking request.setHeaderField on a WebRequest that I have created through a WebConversation. I like the convenience of the ClientFacade though, and would like to use that instead of the WebConversationFactory / WebConversation.
When I use the ClientFacade, there is no Accept-Language header set in the WebRequest. This results in ServletRequest.getLocale returning the server default Locale as the preferred locale for the request. Since I need the tests to run correctly on servers with different default locales, this is undesirable for me.
Is there a way to set the Accept-Language header when using ClientFacade for setting up the WebConversation? It would be best to be able to set the Locale once for the entire conversation, so that the correct header is set in each WebRequest.
Regards,
Pieter Kuijpers