Uploaded image for project: 'Keycloak'
  1. Keycloak
  2. KEYCLOAK-14310

SimpleHttp does not consider ContentType for JSON serialization

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 6.0.1, 7.0.0, 7.0.1, 8.0.0, 8.0.1, 8.0.2, 9.0.0, 9.0.2, 9.0.3, 10.0.0, 10.0.1
    • Fix Version/s: 11.0.0
    • Component/s: None
    • Labels:
      None

      Description

      The SimpleHttp class offers capabilities to issue JSON requests. It leverages Jackson for serialization and uses HttpClient for sending the data. The serialization is done with the help of JsonSerialization.writeValueAsString(...), which correct serializes the JSON into a Unicode Java String. Afterwards the String is passed into new StringEntity(...) signature of HttpClient. This signature assumes that default content-type is text/plain. With this assumption, HttpClient afterwards encodes the Unicode String into ISO-8859-1, which is the default encoding for text/plain. The Content-Type in the HTTP header is correct set to application/json by SimpleHttp, but the encoding of the data is now done in ISO-8859-1, were default of application/json would be UTF-8.
      This could lead to problems on the server receiving the HTTP call, if the data contains special characters which do not work with UTF-8.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  fabians Fabian Schlier
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: