From c3891b6e00daa7a92cca1c88599e046f72926bb4 Mon Sep 17 00:00:00 2001 From: Dmitry Mukhin Date: Mon, 7 Apr 2014 20:31:12 +0400 Subject: set Retry-After header when throttled --- rest_framework/tests/test_throttling.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'rest_framework/tests/test_throttling.py') diff --git a/rest_framework/tests/test_throttling.py b/rest_framework/tests/test_throttling.py index 41bff692..b5ae02cd 100644 --- a/rest_framework/tests/test_throttling.py +++ b/rest_framework/tests/test_throttling.py @@ -117,8 +117,10 @@ class ThrottlingTests(TestCase): response = view.as_view()(request) if expect is not None: self.assertEqual(response['X-Throttle-Wait-Seconds'], expect) + self.assertEqual(response['Retry-After'], expect) else: self.assertFalse('X-Throttle-Wait-Seconds' in response) + self.assertFalse('Retry-After' in response) def test_seconds_fields(self): """ @@ -165,11 +167,13 @@ class ThrottlingTests(TestCase): response = MockView_NonTimeThrottling.as_view()(request) self.assertFalse('X-Throttle-Wait-Seconds' in response) + self.assertFalse('Retry-After' in response) self.assertTrue(MockView_NonTimeThrottling.throttle_classes[0].called) response = MockView_NonTimeThrottling.as_view()(request) self.assertFalse('X-Throttle-Wait-Seconds' in response) + self.assertFalse('Retry-After' in response) class ScopedRateThrottleTests(TestCase): -- cgit v1.2.3