Code example for HttpMessage

Methods: addHeadergetParams

0
    public void testEntityWithContentLength() throws Exception { 
        ContentLengthStrategy lenStrategy = new LaxContentLengthStrategy();
        HttpMessage message = new DummyHttpMessage();
 
        // lenient mode 
        message.getParams().setBooleanParameter(CoreProtocolPNames.STRICT_TRANSFER_ENCODING, false);
        message.addHeader("Content-Type", "unknown");
        message.addHeader("Content-Length", "0");
        Assert.assertEquals(0, lenStrategy.determineLength(message));
    } 
 
    @Test 
    public void testEntityWithMultipleContentLength() throws Exception { 
        ContentLengthStrategy lenStrategy = new LaxContentLengthStrategy();
        HttpMessage message = new DummyHttpMessage();
 
        // lenient mode 
        message.getParams().setBooleanParameter(CoreProtocolPNames.STRICT_TRANSFER_ENCODING, false);
        message.addHeader("Content-Type", "unknown");
        message.addHeader("Content-Length", "0");
        message.addHeader("Content-Length", "0");