Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove charset parameter from MIME type of application/json #3743

Merged
merged 2 commits into from
Dec 14, 2024

Conversation

SaekiTominaga
Copy link
Contributor

fix #3739

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

@yusukebe
Copy link
Member

Hi @SaekiTominaga

Thank you for the PR! I think you should change this line too:

this.#preparedHeaders['content-type'] = 'application/json; charset=UTF-8'

Copy link

codecov bot commented Dec 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.72%. Comparing base (47bb23c) to head (c30bf0d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3743      +/-   ##
==========================================
- Coverage   91.73%   91.72%   -0.01%     
==========================================
  Files         159      159              
  Lines       10177    10177              
  Branches     2883     2888       +5     
==========================================
- Hits         9336     9335       -1     
- Misses        840      841       +1     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@EdamAme-x
Copy link
Contributor

EdamAme-x commented Dec 12, 2024

These files may also need to be changed. (Note: there are multiple lines in the same file.)
Thanks.

'content-type': 'application/json; charset=UTF-8',

this.#preparedHeaders['content-type'] = 'application/json; charset=UTF-8'

'content-type': 'application/json; charset=UTF-8',

expect(res.headers.get('Content-Type')).toMatch('application/json; charset=UTF-8')

expect(isContentTypeBinary('application/json; charset=UTF-8')).toBe(false)

'content-type': 'application/json; charset=UTF-8',

expect(res.headers.get('Content-Type')).toMatch('application/json; charset=UTF-8')

'Content-Type': 'text/plain;charset=utf-8',

expect(isContentTypeBinary('application/json; charset=UTF-8')).toBe(false)

expect(res.headers.get('Content-Type')).toMatch('application/json; charset=UTF-8')

@SaekiTominaga
Copy link
Contributor Author

Thanks for pointing that out!

@yusukebe I have addressed it.
@EdamAme-x I have removed charset parameter or deleted unnecessary test cases.

Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yusukebe yusukebe changed the title fix(utils/mime): Remove charset parameter from MIME type of application/json fix: Remove charset parameter from MIME type of application/json Dec 14, 2024
@yusukebe
Copy link
Member

Thanks @SaekiTominaga ! Looks good. I'll merge it now.

@yusukebe yusukebe merged commit baa231e into honojs:main Dec 14, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

charaset parameter is not required for JSON MIME type
3 participants