Code example for BasicHeader

0
 
    @Test 
    public void testNoDefaultHeadersForConnectRequest() throws Exception { 
        HttpRequest request = new BasicHttpRequest("CONNECT", "www.somedomain.com");
        List<Header> defheaders = new ArrayList<Header>();
        defheaders.add(new BasicHeader("custom", "stuff"));
        request.getParams().setParameter(AllClientPNames.DEFAULT_HEADERS, defheaders);
        HttpContext context = new BasicHttpContext();
 
        HttpRequestInterceptor interceptor = new RequestDefaultHeaders();
        interceptor.process(request, context);
        Header header1 = request.getFirstHeader("custom");
        Assert.assertNull(header1);
    } 
 
    @Test 
    public void testDefaultHeaders() throws Exception { 
        HttpRequest request = new BasicHttpRequest("GET", "/");
        request.addHeader("custom", "stuff");
        List<Header> defheaders = new ArrayList<Header>();
Experience pair programming with AI  Get Codota for Java