def test_onlyRetryIdempotentMethods(self):
"""
Only GET, HEAD, OPTIONS, TRACE, DELETE methods cause a retry.
"""
pool = client.HTTPConnectionPool(None)
connection = client._RetryingHTTP11ClientProtocol(None, pool)
self.assertTrue(connection._shouldRetry(
b"GET", RequestNotSent(), None))
self.assertTrue(connection._shouldRetry(
b"HEAD", RequestNotSent(), None))
self.assertTrue(connection._shouldRetry(
b"OPTIONS", RequestNotSent(), None))
self.assertTrue(connection._shouldRetry(
b"TRACE", RequestNotSent(), None))
self.assertTrue(connection._shouldRetry(
b"DELETE", RequestNotSent(), None))
self.assertFalse(connection._shouldRetry(
b"POST", RequestNotSent(), None))
self.assertFalse(connection._shouldRetry(
b"MYMETHOD", RequestNotSent(), None))
# This will be covered by a different ticket, since we need support
#for resettable body producers:
# self.assertTrue(connection._doRetry("PUT", RequestNotSent(), None))
评论列表
文章目录