You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@abdera.apache.org by se...@cam.ac.uk on 2011/05/11 10:41:32 UTC

Problem with RequestOptions.addHeader

Hi,

The org.apache.abdera.protocol.client.RequestOptions.addHeader method 
seems to be broken right now.

The following unit tests illustrate the problem:

     @Test
     public void testAddHeader() {
         RequestOptions options = new RequestOptions();
         options.addHeader("User-Agent", "Foo");

         // This fails:
         //      java.lang.AssertionError: expected:<1> but was:<0>
         assertEquals(1, options.getHeaderNames().length);
         assertEquals("Foo", options.getHeader("User-Agent"));

     }

     @Test
     public void testSetThenAddHeader() {

         RequestOptions options = new RequestOptions();
         options.setHeader("User-Agent", "Foo");

         assertEquals(1, options.getHeaderNames().length);
         assertEquals("Foo", options.getHeader("User-Agent"));

         // This throws:
         //      java.lang.UnsupportedOperationException
         options.addHeader("User-Agent", "Bar");
     }

Regards,

Sam