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

MockHttpResponse#getContentAsString() should respect encoding of content

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.0.0.Beta1, 3.5.0.CR1
    • 3.0.23.Final
    • jaxrs
    • None

      At the moment MockHttpResponse#getContentAsString() does not respect charset encoding which is provided by the controller-under-test. On other words, if controller's method is annotated with @Produces("application/json;charset=UTF-8") e.g. it sets Content-Type response header, this is ignored by MockHttpResponse. As the result unit test becomes platform encoding dependant.

      It is expected that getContentAsString() captures the encoding and correctly decodes byte stream similar to how Spring MockHttpServletResponse#getContentAsString() does.

            rsearls r searls
            dma_k Dmitry Katsubo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: