mirror of
https://github.com/django/daphne.git
synced 2024-11-21 23:46:33 +03:00
Fix query string encoding to be bytes and not decoded
This commit is contained in:
parent
e02fa95987
commit
fd5928c1b1
|
@ -133,7 +133,7 @@ class WebRequest(http.Request):
|
||||||
"path": self.unquote(self.path),
|
"path": self.unquote(self.path),
|
||||||
"root_path": self.root_path,
|
"root_path": self.root_path,
|
||||||
"scheme": "http",
|
"scheme": "http",
|
||||||
"query_string": self.unquote(self.query_string, plus_as_space=True),
|
"query_string": self.query_string,
|
||||||
"headers": self.clean_headers,
|
"headers": self.clean_headers,
|
||||||
"body": self.content.read(),
|
"body": self.content.read(),
|
||||||
"client": self.client_addr,
|
"client": self.client_addr,
|
||||||
|
|
|
@ -25,7 +25,7 @@ class TestHTTPProtocol(TestCase):
|
||||||
"""
|
"""
|
||||||
# Send a simple request to the protocol
|
# Send a simple request to the protocol
|
||||||
self.proto.dataReceived(
|
self.proto.dataReceived(
|
||||||
b"GET /te%20st-%C3%A0/?foo=bar HTTP/1.1\r\n" +
|
b"GET /te%20st-%C3%A0/?foo=+bar HTTP/1.1\r\n" +
|
||||||
b"Host: somewhere.com\r\n" +
|
b"Host: somewhere.com\r\n" +
|
||||||
b"\r\n"
|
b"\r\n"
|
||||||
)
|
)
|
||||||
|
@ -35,7 +35,7 @@ class TestHTTPProtocol(TestCase):
|
||||||
self.assertEqual(message['method'], "GET")
|
self.assertEqual(message['method'], "GET")
|
||||||
self.assertEqual(message['scheme'], "http")
|
self.assertEqual(message['scheme'], "http")
|
||||||
self.assertEqual(message['path'], "/te st-à/")
|
self.assertEqual(message['path'], "/te st-à/")
|
||||||
self.assertEqual(message['query_string'], "foo=bar")
|
self.assertEqual(message['query_string'], b"foo=+bar")
|
||||||
self.assertEqual(message['headers'], [(b"host", b"somewhere.com")])
|
self.assertEqual(message['headers'], [(b"host", b"somewhere.com")])
|
||||||
self.assertFalse(message.get("body", None))
|
self.assertFalse(message.get("body", None))
|
||||||
self.assertTrue(message['reply_channel'])
|
self.assertTrue(message['reply_channel'])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user