Пример #1
0
    def _copy_source_headers(self):
        env = {}
        for key, value in self.environ.items():
            if key.startswith('HTTP_X_AMZ_COPY_SOURCE_'):
                env[key.replace('X_AMZ_COPY_SOURCE_', '')] = value

        return swob.HeaderEnvironProxy(env)
Пример #2
0
 def test_provider_response_reraise_no_exc_info_long_body(self):
     headers = swob.HeaderEnvironProxy({
         'HTTP_FOO': 'bar',
         'CONTENT_LENGTH': '88',
     })
     r = base_sync.ProviderResponse(True, 204, headers, iter(['A'] * 100))
     with self.assertRaises(ValueError) as cm:
         r.reraise()
     self.assertEqual(
         'reraise had no prior exception for '
         '<%s: %s, %r, %s, %r>' % ('ProviderResponse', 'True', 204,
                                   "{'Content-Length': '88', 'Foo': 'bar'}",
                                   ("A" * 70) + '...'),
         cm.exception.message)