mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 18:08:03 +03:00 
			
		
		
		
	Add Request repr (#7239)
This commit is contained in:
		
							parent
							
								
									57e7cc21e1
								
							
						
					
					
						commit
						dd33ebb4e2
					
				| 
						 | 
				
			
			@ -179,6 +179,13 @@ class Request:
 | 
			
		|||
            forced_auth = ForcedAuthentication(force_user, force_token)
 | 
			
		||||
            self.authenticators = (forced_auth,)
 | 
			
		||||
 | 
			
		||||
    def __repr__(self):
 | 
			
		||||
        return '<%s.%s: %s %r>' % (
 | 
			
		||||
            self.__class__.__module__,
 | 
			
		||||
            self.__class__.__name__,
 | 
			
		||||
            self.method,
 | 
			
		||||
            self.get_full_path())
 | 
			
		||||
 | 
			
		||||
    def _default_negotiator(self):
 | 
			
		||||
        return api_settings.DEFAULT_CONTENT_NEGOTIATION_CLASS()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -272,6 +272,12 @@ class TestSecure(TestCase):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class TestHttpRequest(TestCase):
 | 
			
		||||
    def test_repr(self):
 | 
			
		||||
        http_request = factory.get('/path')
 | 
			
		||||
        request = Request(http_request)
 | 
			
		||||
 | 
			
		||||
        assert repr(request) == "<rest_framework.request.Request: GET '/path'>"
 | 
			
		||||
 | 
			
		||||
    def test_attribute_access_proxy(self):
 | 
			
		||||
        http_request = factory.get('/')
 | 
			
		||||
        request = Request(http_request)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user