这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@jordanshatford
Copy link
Contributor

Better handle more content types based on: https://www.iana.org/assignments/media-types/media-types.xhtml

ref: #152 (pdf content type as binary)

@jordanshatford jordanshatford requested a review from mrlubos March 31, 2024 07:59
@codecov
Copy link

codecov bot commented Mar 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.70%. Comparing base (60f044b) to head (df22d0a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #195   +/-   ##
=======================================
  Coverage   90.70%   90.70%           
=======================================
  Files          66       66           
  Lines        4000     4000           
  Branches      477      477           
=======================================
  Hits         3628     3628           
  Misses        371      371           
  Partials        1        1           
Flag Coverage Δ
unittests 90.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

export const getRequestBody = (options: ApiRequestOptions): unknown => {
if (options.body) {
if (options.mediaType?.includes('/json')) {
if (options.mediaType?.includes('application/json') || options.mediaType?.includes('+json')) {
Copy link
Member

Choose a reason for hiding this comment

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

Why not make this just endsWith('json')?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It may not always end with json, as there may be charset information in the header. JSON with always be application/json or something/something+json (but may be appended by "; charset=utf8")

Copy link
Member

Choose a reason for hiding this comment

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

How about includes json then? Why not drop + and /?

@jordanshatford jordanshatford merged commit a8a164d into main Mar 31, 2024
@jordanshatford jordanshatford deleted the feat/better-content-type-handling branch March 31, 2024 23:34
@github-actions github-actions bot mentioned this pull request Mar 31, 2024
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.

3 participants