mirror of
https://github.com/sprockets/sprockets.mixins.http.git
synced 2024-11-15 03:00:29 +00:00
Merge pull request #38 from nvllsvm/link
Change HTTPResponse.links to return empty list when Link header is not present
This commit is contained in:
commit
19d4bd5a26
3 changed files with 7 additions and 3 deletions
|
@ -1,6 +1,10 @@
|
||||||
Version History
|
Version History
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
Next
|
||||||
|
----
|
||||||
|
- Change ``HTTPResponse.links`` to return empty list when ``Link`` header is not present
|
||||||
|
|
||||||
`2.4.1`_ Nov 30 2020
|
`2.4.1`_ Nov 30 2020
|
||||||
--------------------
|
--------------------
|
||||||
- Make request retry timeout configurable
|
- Make request retry timeout configurable
|
||||||
|
|
|
@ -152,8 +152,8 @@ class HTTPResponse:
|
||||||
"""
|
"""
|
||||||
if not self._responses:
|
if not self._responses:
|
||||||
return None
|
return None
|
||||||
if 'Link' in self._responses[-1].headers:
|
|
||||||
links = []
|
links = []
|
||||||
|
if 'Link' in self._responses[-1].headers:
|
||||||
for l in headers.parse_link(self._responses[-1].headers['Link']):
|
for l in headers.parse_link(self._responses[-1].headers['Link']):
|
||||||
link = {'target': l.target}
|
link = {'target': l.target}
|
||||||
link.update({k: v for (k, v) in l.parameters})
|
link.update({k: v for (k, v) in l.parameters})
|
||||||
|
|
2
tests.py
2
tests.py
|
@ -258,7 +258,7 @@ class MixinTestCase(testing.AsyncHTTPTestCase):
|
||||||
'foo': ['bar'],
|
'foo': ['bar'],
|
||||||
'status_code': ['200']
|
'status_code': ['200']
|
||||||
})
|
})
|
||||||
self.assertIsNone(response.links)
|
self.assertEqual(response.links, [])
|
||||||
|
|
||||||
@testing.gen_test
|
@testing.gen_test
|
||||||
def test_post(self):
|
def test_post(self):
|
||||||
|
|
Loading…
Reference in a new issue