Commit graph

27 commits

Author SHA1 Message Date
Dave Shawley
d605acb5b7
Deprecate not configuring a default content type. 2021-10-03 15:52:48 -04:00
Dave Shawley
4dd46eda5b
Return 406 Not Acceptable appropriately.
If there is no default content type and nothing matches in the Accept
header, previous versions would fail with an Internal Server Error
because of an unhandled exception.  Instead we should be returning
a "406 Not Acceptable".
2021-10-03 15:52:47 -04:00
Dave Shawley
de43997df5
Reformat using yapf.
https://github.com/sprockets/sprockets.mixins.mediatype/issues/35
2021-09-19 09:58:08 -04:00
Dave Shawley
c6551e8024
Stop using the tornado reloader in tests.
This causes some interesting warnings.
2021-09-12 18:34:16 -04:00
Dave Shawley
21c6cb73fe Invalid content-type --> 400 Bad Request.
ietfparse raises a `ValueError` from `parse_content_type` which was
uncaught and resulted in an internal server error.
2020-10-29 13:50:33 -04:00
Andrew Rabert
723ed25edb Add test to ensure context suffix is handled with ietfparse<1.5.1 behavior 2018-11-30 11:58:39 -05:00
Andrew Rabert
a28633aef5 Address flake8 complaints 2018-11-28 11:50:43 -05:00
Andrew Rabert
fd3f8b3008 Python 3 updates
- Simplify super()
- Remove object inheritance
- Simplify package namespacing
- Remove BinaryWrapper
- Remove python 2 code paths
2018-11-28 11:50:40 -05:00
Dave Shawley
18e134b6f2 Deprecate ContentSettings.from_application. 2016-04-05 07:47:41 -04:00
Dave Shawley
68fe438894 content: Add install and get_settings functions. 2016-04-05 07:46:57 -04:00
Dave Shawley
a1cc214bbe ContentMixin: Set the Vary header.
This lets any transparent caches that our responses will vary based on
the Accept header.  Without this, caches will assume that a cached
response can be used even if the Accept header differs.
2016-03-13 09:34:32 -04:00
Dave Shawley
206e43ee7d ContentMixin: Raise 400 when body decode fails. 2016-02-22 09:58:58 -05:00
Dave Shawley
ed357d878f Strip charset parameter from text content types. 2016-01-31 12:14:20 -05:00
Dave Shawley
995c715405 Normalize registered content types.
MIME content type strings are normalized by lower-casing the content
type parameters and then sorting them.  Each parameter is preceded by a
space.
2016-01-31 12:11:11 -05:00
Dave Shawley
98e3719a8b MsgPackTranscoder: Add BinaryWrapper override. 2016-01-18 07:58:30 -05:00
Dave Shawley
3a65dea053 MsgPackTranscoder: Handle binary data values. 2016-01-18 07:58:11 -05:00
Dave Shawley
ba3d7cfc84 MsgPackTranscoder: Add support for UUID and datetimes. 2016-01-18 07:58:11 -05:00
Dave Shawley
7d2237745e Add s.m.mediatype.transcoders.MsgPackTranscoder. 2016-01-18 07:58:07 -05:00
Dave Shawley
8a44e527b1 Add explicit tests for handlers.add_*
Adding JSON and msgpack transcoders in the examples will obliviate
testing of the add_binary_content_type and add_text_content_type
functions.
2016-01-16 09:56:38 -05:00
Dave Shawley
3eecbad5c5 content.ContentSettings: Fix AttributeError in __setitem__.
Code coverage FTW!
2016-01-16 09:56:38 -05:00
Dave Shawley
61713f9f15 JSONTranscoder: Add support for datetime, UUID, and binary types. 2016-01-16 09:56:38 -05:00
Dave Shawley
f47a9b2aba tests: Correct msgpack-related test.
This would fail if you inspected the response body :/
2015-11-02 14:25:36 -05:00
Amber Heilman
212dcb7876 default to the set content type default in settings 2015-09-14 11:13:07 -04:00
Dave Shawley
f766a24e26 Add request body negotiation. 2015-08-26 14:50:48 -04:00
Dave Shawley
7305cad7e7 Add response type negotiation. 2015-08-19 18:29:11 -04:00
Dave Shawley
c67d1af19d Implement basic content handling framework. 2015-08-19 17:53:46 -04:00
Dan Tracy
f73a5e07ce Initial commit 2015-06-09 09:28:29 -04:00