mirror of
https://github.com/sprockets/sprockets.mixins.http.git
synced 2024-11-15 03:00:29 +00:00
commit
f5ea3ccb8d
2 changed files with 17 additions and 1 deletions
|
@ -338,7 +338,7 @@ class HTTPClientMixin:
|
|||
request_headers['X-Retry-Attempt'] = str(attempt + 1)
|
||||
try:
|
||||
resp = await client.fetch(
|
||||
url,
|
||||
str(url),
|
||||
method=method,
|
||||
headers=request_headers,
|
||||
body=body,
|
||||
|
|
16
tests.py
16
tests.py
|
@ -557,3 +557,19 @@ class MixinTestCase(testing.AsyncHTTPTestCase):
|
|||
self.assertEqual(response.code, 429)
|
||||
self.assertEqual(response.attempts, 1)
|
||||
self.assertEqual([r.code for r in response.history], [429])
|
||||
|
||||
@testing.gen_test
|
||||
def test_str_url(self):
|
||||
class MyURL:
|
||||
def __init__(self, url):
|
||||
self._url = url
|
||||
|
||||
def __str__(self):
|
||||
return self._url
|
||||
|
||||
mixin = http.HTTPClientMixin()
|
||||
response = yield mixin.http_fetch(
|
||||
MyURL(self.get_url('/test?foo=bar&status_code=200')))
|
||||
self.assertTrue(response.ok)
|
||||
self.assertEqual(response.code, 200)
|
||||
self.assertEqual(response.attempts, 1)
|
||||
|
|
Loading…
Reference in a new issue