Skip to content

Commit

Permalink
fix query param encoding spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
keotl committed Oct 2, 2022
1 parent eb2f478 commit bf46d6d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions e2e_test/tests/test_simple_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ def test_getWithQueryParameters(self):
self.assertEqual(200, response.status_code)
self.assertThat(GET_WITH_PARAMETERS).is_contained()

def test_getWithQueryParametersWithSpaces(self):
response = http.get("/params?query=query+with+spaces%20+%25&age=13")

self.assertEqual(200, response.status_code)
self.assertThat(GET_WITH_PARAMETERS + " query with spaces % 13").is_stored()

def test_givenMissingOrMalformedQueryParams_thenReturn400BadRequest(self):
response = http.get("/params?query=foo&age=a")

Expand Down
4 changes: 2 additions & 2 deletions jivago/wsgi/request/request.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from urllib.parse import unquote
from urllib.parse import unquote, unquote_plus

from jivago.wsgi.invocation.url_encoded_form_parser import parse_urlencoded_form
from jivago.wsgi.methods import to_method
Expand All @@ -12,7 +12,7 @@ def __init__(self, method: str, path: str, headers: Headers, query_string: str,
self.path = unquote(path)
self.headers = headers
self.body = body
self.queryString = unquote(query_string)
self.queryString = unquote_plus(query_string)
self._query_form = None

@property
Expand Down

0 comments on commit bf46d6d

Please sign in to comment.