[x] Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a jets upgrade command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/
[x] Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.rubyonjets.com
[x] Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.
My Environment
Software
Version
Operating System
MacOS 10.14.3
Jets
1.6.4
Ruby
2.5.3
Expected Behaviour
When rendering as xml I would expect Jets to set a Content-Type header set to application/xml.
Current Behavior
When you render a string as xml from a controller the Content-Type is set totext/html`
Step-by-step reproduction instructions
Create a Jets application and a controller. Create an action that renders the result as xml:
class MessagesController > ApplicationController
def create
render xml: "<Hello>World</Hello>"
end
end
Create a route for the action. Run the application and visit the route. The response header is text/html.
I am raising this as a bug as the content is rendered when it is passed via render xml: content but it's not served correctly.
Solution Suggestion
This is something that Rails handles, so I'm surprised it didn't work in Jets as the rendering is handed off to ActionController::Base. I tried to follow the render path, which lead me to setting up the render options which shows that the xml key is handled. But I couldn't find where it went from there and where the response headers were set.
Workaround
You can work around this for now by manually setting the content type:
Checklist
jets upgrade
command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/My Environment
Expected Behaviour
When rendering as
xml
I would expect Jets to set aContent-Type
header set toapplication/xml
.Current Behavior
When you render a string as xml from a controller the
Content-Type is set to
text/html`Step-by-step reproduction instructions
Create a Jets application and a controller. Create an action that renders the result as xml:
Create a route for the action. Run the application and visit the route. The response header is
text/html
.I am raising this as a bug as the content is rendered when it is passed via
render xml: content
but it's not served correctly.Solution Suggestion
This is something that Rails handles, so I'm surprised it didn't work in Jets as the rendering is handed off to
ActionController::Base
. I tried to follow the render path, which lead me to setting up the render options which shows that thexml
key is handled. But I couldn't find where it went from there and where the response headers were set.Workaround
You can work around this for now by manually setting the content type: