Code example for BasicHttpRequest

Methods: getFirstHeader

0
 
public class TestRequestAcceptEncoding { 
 
    @Test 
    public void testAcceptEncoding() throws Exception { 
        HttpRequest request = new BasicHttpRequest("GET", "/");
        HttpContext context = new BasicHttpContext();
 
        HttpRequestInterceptor interceptor = new RequestAcceptEncoding();
        interceptor.process(request, context);
        Header header = request.getFirstHeader("Accept-Encoding");
        Assert.assertNotNull(header);
        Assert.assertEquals("gzip,deflate", header.getValue());
    } 
 
    @Test 
    public void testAcceptEncodingAlreadyPResent() throws Exception { 
        HttpRequest request = new BasicHttpRequest("GET", "/");
        request.addHeader("Accept-Encoding", "stuff");
        HttpContext context = new BasicHttpContext();
Experience pair programming with AI  Get Codota for Java