示例#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')
示例#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')
示例#3
0
 def test_http_host(self):
     result = get_host({'HTTP_HOST': 'example.com'})
     self.assertEquals(result, 'example.com')
示例#4
0
 def test_http_x_forwarded_host(self):
     result = get_host({'HTTP_X_FORWARDED_HOST': 'example.com'})
     self.assertEquals(result, 'example.com')