luckyframework / luckyframework/lucky_cli
Add `set_default_content_type` to `ApiAction`
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 92
- Forks
- 48
- PR merge metrics
- No merged PRs in 30d
Description
If a client forgets to set a content type, we should set a default for them so that Lucky knows what kind of params to expect.
I think we can add a `before set_default_content_type` to `ApiAction` and the method would look something like this:
```crystal
def set_default_content_type
response.headers["Content-Type"] ||= "application/json"
continue
end
```
@jwoertink could you try this in your app and leave feedback on if it works/suggested improvements?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating ApiAction and reading how its before hooks and response headers are handled. Verify that a missing content type receives the proposed JSON default and that existing content types remain unchanged; the issue does not name a test file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- crystal
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100