Skip to content

View controller doesn't allow defining specific content type and character encoding #918

@bivapa

Description

@bivapa

Expected Behavior

When I define a controller with a View response type and I set a specific content type and character encoding on the response object I expect these content type and character encoding to actually be applied to the rendered response.

Actual Behaviour

When I define a controller with a View response type and I set a specific content type and character encoding on the response object the actual rendered response contains default content type (text/html) and character encoding (UTF-8).

Steps To Reproduce

  1. Clone the example application
  2. Run mvn test
  3. The following tests will fail:
  • testViewControllerReturnsDefinedMediaType
  • testViewControllerReturnsDefinedCharacterEncoding
  1. The test testViewControllerEncodesCorrectCharacters will pass as the response content is interpreted as UTF-8
  2. The tests testTextControlller... will pass as the ordinary controller works as expected

Environment Information

Java 17

Example Application

https://github.com/bivapa/micronaut-view-char-encoding-bug-report

Version

4.6.3

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