Skip to content

Commit 8894236

Browse files
authored
Merge branch 'dev' into dajusto/add-df-templates
2 parents bb81312 + b85eb7a commit 8894236

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

azure/functions/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,4 @@
9797
'HttpMethod'
9898
)
9999

100-
__version__ = '1.19.0b3'
100+
__version__ = '1.19.0'

azure/functions/_http_wsgi.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ def __init__(self,
2929
# Implement interfaces for PEP 3333 environ
3030
self.request_method = getattr(func_req, 'method', None)
3131
self.script_name = ''
32-
self.path_info = unquote_to_bytes(
33-
getattr(url, 'path', None)).decode('latin-1') # type: ignore
32+
self.path_info = (
33+
unquote_to_bytes(getattr(url, 'path', None)) # type: ignore
34+
.decode('latin-1' if type(self) is WsgiRequest else 'utf-8')
35+
)
36+
3437
self.query_string = getattr(url, 'query', None)
3538
self.content_type = self._lowercased_headers.get('content-type')
3639
self.content_length = str(len(func_req_body))

tests/test_http_wsgi.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
WsgiResponse,
1515
WsgiMiddleware
1616
)
17+
from azure.functions._http_asgi import AsgiRequest
1718

1819

1920
class WsgiException(Exception):
@@ -211,6 +212,18 @@ def test_middleware_wrapper(self):
211212
self.assertEqual(func_response.status_code, 200)
212213
self.assertEqual(func_response.get_body(), b'sample string')
213214

215+
def test_path_encoding_utf8(self):
216+
url = 'http://example.com/Pippi%20L%C3%A5ngstrump'
217+
request = AsgiRequest(self._generate_func_request(url=url))
218+
219+
self.assertEqual(request.path_info, u'/Pippi L\u00e5ngstrump')
220+
221+
def test_path_encoding_latin1(self):
222+
url = 'http://example.com/Pippi%20L%C3%A5ngstrump'
223+
request = WsgiRequest(self._generate_func_request(url=url))
224+
225+
self.assertEqual(request.path_info, u'/Pippi L\u00c3\u00a5ngstrump')
226+
214227
def _generate_func_request(
215228
self,
216229
method="POST",

0 commit comments

Comments
 (0)