コード例 #1
0
ファイル: test_util.py プロジェクト: jerith/txspinneret
 def test_contentEncoding(self):
     """
     Use the encoding specified in the ``Content-Type`` header.
     """
     headers = Headers({b'Content-Type': [b'text/plain;charset=utf-32']})
     self.assertThat(
         contentEncoding(headers),
         Equals(b'utf-32'))
コード例 #2
0
ファイル: test_util.py プロジェクト: jerith/txspinneret
 def test_customDefault(self):
     """
     Allow specifying a default encoding.
     """
     headers = Headers()
     self.assertThat(
         contentEncoding(headers, b'utf-32'),
         Equals(b'utf-32'))
コード例 #3
0
ファイル: test_util.py プロジェクト: jerith/txspinneret
 def test_default(self):
     """
     If there is no ``Content-Type`` header then use the default encoding.
     """
     headers = Headers()
     self.assertThat(
         contentEncoding(headers),
         Equals(b'utf-8'))
コード例 #4
0
ファイル: test_util.py プロジェクト: jerith/txspinneret
 def test_noCharset(self):
     """
     If the ``Content-Type`` header does not specify a charset then use the
     default encoding.
     """
     headers = Headers({'Content-Type': ['text/plain']})
     self.assertThat(
         contentEncoding(headers),
         Equals(b'utf-8'))
コード例 #5
0
ファイル: route.py プロジェクト: jonathanj/txspinneret
 def _match(request, value):
     return name, query.Integer(value, base=base, encoding=contentEncoding(request.requestHeaders, encoding))
コード例 #6
0
ファイル: route.py プロジェクト: jonathanj/txspinneret
 def _match(request, value):
     return name, query.Text(value, encoding=contentEncoding(request.requestHeaders, encoding))