allow non-ascii characters in request URLs

This commit is contained in:
Waldemar Hummer 2017-08-05 20:29:40 +10:00
commit 24d1562d2f
2 changed files with 25 additions and 0 deletions

View file

@ -1,3 +1,5 @@
# coding=utf-8
from __future__ import unicode_literals
import sure # noqa
@ -78,3 +80,18 @@ def test_s3_server_post_without_content_length():
res = test_client.post('/', "https://tester.localhost:5000/", environ_overrides={'CONTENT_LENGTH': ''})
res.status_code.should.equal(411)
def test_s3_server_post_unicode_bucket_key():
# Make sure that we can deal with non-ascii characters in request URLs (e.g., S3 object names)
dispatcher = server.DomainDispatcherApplication(server.create_backend_app)
backend_app = dispatcher.get_application({
'HTTP_HOST': 's3.amazonaws.com',
'PATH_INFO': '/test-bucket/test-object-てすと'
})
assert backend_app
backend_app = dispatcher.get_application({
'HTTP_HOST': 's3.amazonaws.com',
'PATH_INFO': '/test-bucket/test-object-てすと'.encode('utf-8')
})
assert backend_app