Results 1 to 2 of 2

Thread: MockHttpServletRequest bug

  1. #1
    Join Date
    Sep 2005
    Location
    Australia
    Posts
    11

    Default MockHttpServletRequest bug

    Hi,

    Couldn't find a section for the Mock objects so I will post the problem here.
    Sorry for any inconveniences.

    I think I found two problems with the MockHttpServletRequest implementation, but they seem so obvious that I think I might be doing soemthing wrong :-)

    The first problem is that the getHeader isn't case-insensitive:

    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addHeader("Header", "value1");
    assertEquals("value1", request.getHeader("header")); // this test fails

    The second one is that if you add more values to the same header the getHeader should return just the first value, you should get access to the other values by getHeaders.

    request.addHeader("Header", "value1");
    request.addHeader("Header", "value2");
    assertEquals("value1", request.getHeader("Header")); // getHeader returns value1,value2

    As I said they seem to be bugs but it it is so I can't believe nobody noticed it before.


    Thanks,

    Tamas

  2. #2
    Join Date
    Sep 2005
    Location
    Australia
    Posts
    11

    Default

    I've just checked the code, they seem to be bugs.

    I raised two bugs in JIRA.

    Tamas

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •