This opens up a new escape hatch for setting the content type header on different responses like json, xml or plain_text. This also creates a new method that can be overridden at the individual action or base action to globally set your content type for each different response type you use. You always have the option to get real custom with send_text_response that requires setting your own custom content type.
I didn't add an argument to html or component due to the named args that those take in. This would end up causing some conflicts similar to how the status worked for html.
I went with the method option here so you could have this set more globally scoped than if we did a block wrapper or functional style.
class BrowserAction < Lucky::Action
def html_content_type
"your_custom_html_content_type"
end
end
That issue also specified the server response status, but I figure since you can already set that, we may as well just leave that as is for now. This way at least gives us additional escape hatches to push towards 1.0
Checklist
[x] - An issue already exists detailing the issue/or feature request that this PR fixes
[x] - All specs are formatted with crystal tool format spec src
[x] - Inline documentation has been added and/or updated
[x] - Lucky builds on docker with ./script/setup
[x] - All builds and specs pass on docker with ./script/test
Purpose
Fixes #1580
Description
This opens up a new escape hatch for setting the content type header on different responses like
json
,xml
orplain_text
. This also creates a new method that can be overridden at the individual action or base action to globally set your content type for each different response type you use. You always have the option to get real custom withsend_text_response
that requires setting your own custom content type.I didn't add an argument to
html
orcomponent
due to the named args that those take in. This would end up causing some conflicts similar to how the status worked for html.I went with the method option here so you could have this set more globally scoped than if we did a block wrapper or functional style.
That issue also specified the server response status, but I figure since you can already set that, we may as well just leave that as is for now. This way at least gives us additional escape hatches to push towards 1.0
Checklist
crystal tool format spec src
./script/setup
./script/test