Skip to content

Controller render() is setting the Content-Type to text/html by default even with non-html content #10337

@ColinHarrington

Description

@ColinHarrington

Task List

  • Steps to reproduce provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Use the render() method specifying a view but without a contentType
  2. Utilize a gson view or non-html view
  3. Observe that the Content-Type is set to text/html
  4. Without specifying the view name (relying on the convention) the Content-Type is set appropriately

Expected Behaviour

The Content-Type should be set by the view layer

Actual Behaviour

The Content-Type is defaulted to 'text/html'

Environment Information

  • Operating System: Linux
  • Grails Version: 3.1+
  • JDK Version: 1.8

Example Application

Exposed in grails-views after 1.1.2
apache/grails-views#93

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions