mirror of
https://github.com/sprockets/sprockets.mixins.mediatype.git
synced 2024-11-22 03:00:25 +00:00
commit
14f3533517
3 changed files with 15 additions and 1 deletions
|
@ -1,6 +1,10 @@
|
|||
Version History
|
||||
===============
|
||||
|
||||
`Next Release`_
|
||||
---------------
|
||||
- Set the _`Vary` header if we are setting the content type.
|
||||
|
||||
`2.0.1`_ (29 Feb 2016)
|
||||
----------------------
|
||||
- Removed deprecation wrapper since it seems to cause really interesting
|
||||
|
@ -38,10 +42,13 @@ Version History
|
|||
---------------------
|
||||
- Initial Release
|
||||
|
||||
.. _Next Release: https://github.com/sprockets/sprockets.http/compare/2.0.0...HEAD
|
||||
.. _Next Release: https://github.com/sprockets/sprockets.http/compare/2.0.1...HEAD
|
||||
.. _2.0.1: https://github.com/sprockets/sprockets.http/compare/2.0.0...2.0.1
|
||||
.. _2.0.0: https://github.com/sprockets/sprockets.http/compare/1.0.4...2.0.0
|
||||
.. _1.0.4: https://github.com/sprockets/sprockets.http/compare/1.0.3...1.0.4
|
||||
.. _1.0.3: https://github.com/sprockets/sprockets.http/compare/1.0.2...1.0.3
|
||||
.. _1.0.2: https://github.com/sprockets/sprockets.http/compare/1.0.1...1.0.2
|
||||
.. _1.0.1: https://github.com/sprockets/sprockets.http/compare/1.0.0...1.0.1
|
||||
.. _1.0.0: https://github.com/sprockets/sprockets.http/compare/0.0.0...1.0.0
|
||||
|
||||
.. _Vary: http://tools.ietf.org/html/rfc7234#section-4.1
|
||||
|
|
|
@ -303,4 +303,5 @@ class ContentMixin(object):
|
|||
content_type, data_bytes = handler.to_bytes(body)
|
||||
if set_content_type:
|
||||
self.set_header('Content-Type', content_type)
|
||||
self.add_header('Vary', 'Accept')
|
||||
self.write(data_bytes)
|
||||
|
|
6
tests.py
6
tests.py
|
@ -95,6 +95,12 @@ class SendResponseTests(testing.AsyncHTTPTestCase):
|
|||
self.assertEqual(response.headers['Content-Type'],
|
||||
'application/json; charset="utf-8"')
|
||||
|
||||
def test_that_vary_header_is_set(self):
|
||||
response = self.fetch('/', method='POST', body=umsgpack.packb({}),
|
||||
headers={'Content-Type': 'application/msgpack'})
|
||||
self.assertEqual(response.code, 200)
|
||||
self.assertEqual(response.headers['Vary'], 'Accept')
|
||||
|
||||
|
||||
class GetRequestBodyTests(testing.AsyncHTTPTestCase):
|
||||
|
||||
|
|
Loading…
Reference in a new issue