Beispiel #1
0
 def test_http_nonstandard_port(self):
     result = get_host({
         'wsgi.url_scheme': 'http',
         'SERVER_NAME': 'example.com',
         'SERVER_PORT': '81',
     })
     self.assertEquals(result, 'example.com:81')
Beispiel #2
0
 def test_https_strips_port(self):
     result = get_host({
         'wsgi.url_scheme': 'https',
         'SERVER_NAME': 'example.com',
         'SERVER_PORT': '443',
     })
     self.assertEquals(result, 'example.com')
Beispiel #3
0
 def test_http_host(self):
     result = get_host({'HTTP_HOST': 'example.com'})
     self.assertEquals(result, 'example.com')
Beispiel #4
0
 def test_http_x_forwarded_host(self):
     result = get_host({'HTTP_X_FORWARDED_HOST': 'example.com'})
     self.assertEquals(result, 'example.com')