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

Add Response media type detection #31

Merged
merged 4 commits into from
Jan 14, 2021
Merged

Conversation

nslaughter
Copy link
Member

@nslaughter nslaughter commented Jan 14, 2021

What?

We're making media_types exclusive with a method on the custom response which allows as to set them appropriately.
Addresses #29

Why?

Proper rendering of the content depends upon the media_content.

How?

  1. Created a custom Response type to wrap the one we've been using from pylonsproject's webob.
  2. Added a method called set_body_and_content_type to encode body to match content-type.

Testing?

We test that the response helper performs as expected for json, text, and html in test_text_response_helper, test_html_response_helper, and test_json_response_helper. We also test manually setting the body with test_manually_setting_body.

Nathan Slaughter added 4 commits January 14, 2021 08:31
The custom response type wraps the webob type with some modest changes.
The tests were passing, but we weren't at project standards. I was
assigning None to typed variables without Optional. We had a test that
would have failed, but for the same name overwriting it later in the
file. And there were issues with the types in the attributes of the
Response where I wanted to set some properties to None at this time,
but I didn't type them as Optional.
@nslaughter nslaughter merged commit 5417470 into main Jan 14, 2021
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.

1 participant