Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-207

When looking for message body reader, content-type should be looked up lowercased

XMLWordPrintable

      Resteasy uses the request content-type information to find a suitable reader. It seems it is currently doing it in a case sensitive way. I think it should be case insensitive.
      So if I have a content-type
      multipart/form-data it passes
      Multipart/form-data it fails
      multipart/Form-data it does not fail, but I think it is because resteasy looks up wildcard matches for subtypes too.

      In method o.j.resteasy.core.MediaTypeMap.getPossible(MediaType) has a part currently looking so:
      SubtypeMap<T> indexed = index.get(accept.getType());
      instead accept.getType() there should be accept.getType().toLowerCase().
      And in o.j.resteasy.core.MediaTypeMap.SubtypeMap.getPossible(MediaType) there are several calls to accept.getSubtype() they should all be accept.getSubtype().toLowerCase().

      Interesting side note: when resteasy can't find a reader it throws an exception but in the exception message the content-type information is already lowercased, because in o.j.resteasy.plugins.delegates.MediaTypeHeaderDelegate.toString() has this:
      String rtn = type.getType().toLowerCase() + "/" + type.getSubtype().toLowerCase();

            patriot1burke@gmail.com Bill Burke (Inactive)
            akiraly Attila Király (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: