Skip to content

[Improvement] The Metadata should handle all the case sensitivities #1588

@sigee

Description

@sigee

What would you like to be improved?

According to https://www.ietf.org/rfc/rfc2616.txt (4.2 Message Headers), HTTP headers are case insensitive.

The Metadata should handle all the case sensitivities, not just lowercase.

Example test case:

    @Test
    void testGetFirstValueShouldReturnValueWithoutDependingOnCaseSensitivity() {
        Metadata metadata = new Metadata();
        metadata.addValue("location", "http://example.com");
        Assertions.assertEquals("http://example.com", metadata.getFirstValue("location"));
        Assertions.assertEquals("http://example.com", metadata.getFirstValue("Location"));
        Assertions.assertEquals("http://example.com", metadata.getFirstValue("LOCATION"));

        Metadata metadata2 = new Metadata();
        metadata2.addValue("Location", "http://example.com");
        Assertions.assertEquals("http://example.com", metadata2.getFirstValue("location"));
        Assertions.assertEquals("http://example.com", metadata2.getFirstValue("Location"));
        Assertions.assertEquals("http://example.com", metadata2.getFirstValue("LOCATION"));

        Metadata metadata3 = new Metadata();
        metadata3.addValue("LOCATION", "http://example.com");
        Assertions.assertEquals("http://example.com", metadata3.getFirstValue("location"));
        Assertions.assertEquals("http://example.com", metadata3.getFirstValue("Location"));
        Assertions.assertEquals("http://example.com", metadata3.getFirstValue("LOCATION"));
    }

How should we improve?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions