mirror of
https://github.com/sprockets/sprockets.mixins.http.git
synced 2024-11-14 19:29:31 +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,13 +152,13 @@ class HTTPResponse:
|
||||||
"""
|
"""
|
||||||
if not self._responses:
|
if not self._responses:
|
||||||
return None
|
return None
|
||||||
|
links = []
|
||||||
if 'Link' in self._responses[-1].headers:
|
if 'Link' in self._responses[-1].headers:
|
||||||
links = []
|
|
||||||
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})
|
||||||
links.append(link)
|
links.append(link)
|
||||||
return links
|
return links
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ok(self):
|
def ok(self):
|
||||||
|
|
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