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

Support extension of JSON mimetype #167

Merged
merged 2 commits into from
Jul 24, 2019
Merged

Support extension of JSON mimetype #167

merged 2 commits into from
Jul 24, 2019

Conversation

lmazuel
Copy link
Member

@lmazuel lmazuel commented Jul 5, 2019

Fix #140

@lmazuel lmazuel requested a review from johanste July 5, 2019 19:26
'text/json' # Because we're open minded people...
]
# Accept "text" because we're open minded people...
JSON_REGEXP = re.compile(r'(application|text)/([a-z+.]+\+)?json')
Copy link
Member

Choose a reason for hiding this comment

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

This still won't match content types with parameters:

Example: Content-type: application/json; charset=utf-8

Not blocking the PR for this. Just letting you know...

Copy link
Member

Choose a reason for hiding this comment

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

Unless the parameters have already been stripped off (which it looks like they may have been at this point)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, they have at this point (see a little later in the file).

raw_deserializer.on_response(None, response, stream=False)
result = response.context["deserialized_data"]
assert result["success"] is True

# JSON with UTF-8 BOM
response = build_response(b'\xef\xbb\xbf{"success": true}', content_type="application/json; charset=utf-8")
Copy link
Member

Choose a reason for hiding this comment

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

Isn't adding a BOM in violation of https://tools.ietf.org/html/rfc7158#section-8.1?

Copy link
Member Author

Choose a reason for hiding this comment

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

@codecov-io
Copy link

codecov-io commented Jul 24, 2019

Codecov Report

Merging #167 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #167      +/-   ##
==========================================
+ Coverage   87.84%   87.84%   +<.01%     
==========================================
  Files          25       25              
  Lines        2583     2584       +1     
==========================================
+ Hits         2269     2270       +1     
  Misses        314      314
Impacted Files Coverage Δ
msrest/pipeline/universal.py 95.09% <100%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c4086bf...852f412. Read the comment docs.

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.

Response content type json parser
3 participants