I am trying to check the HttpServletRequest , and for this I used Mockito as follows:
HttpServletRequest mockedRequest = Mockito.mock(HttpServletRequest.class);
now before putting the http request into the assert methods, I just want to create a simple HTTP header, as shown below, without starting the real server:
x-real-ip:127.0.0.1 host:example.com x-forwarded-for:127.0.0.1 accept-language:en-US,en;q=0.8 cookie:JSESSIONID=<session_ID>
Can anyone help how I can build such a test header? thanks.
source share