Skip to content

Store HTTP headers in case-insensitive map #130

Open
@akandybaev

Description

@akandybaev

Issue Summary

While creating Response object the library puts all headers in java.util.HashMap which is case-sensitive (see: https://github.com/sendgrid/java-http-client/blob/main/src/main/java/com/sendgrid/Client.java#L163). It works fine when nothing messes up with headers. But when, for example, Istio sidecar is running along the application that uses SendGrid envoy proxy lower-cases all HTTP headers (e.g. X-Message-Id becomes x-message-id). In order to keep things working one has to manually write logic for looking both X-Message-Id and x-message-id which is rather inconvenient. Having headers stored in something like java.util.TreeMap with String.CASE_INSENSITIVE_ORDER comparator would make work with headers much easier.

Steps to Reproduce

Run SendGrid application along with something that manipulates headers (e.g. makes all of them lower-case).

Technical details:

  • java-http-client version: 4.3.6
  • java version: OpenJDK 11

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