Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[rest] Slight clean-up in HttpClient
  • Loading branch information
romainr committed May 6, 2021
1 parent d9fa32f commit d2342a6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions desktop/core/src/desktop/lib/rest/http_client.py
Expand Up @@ -192,10 +192,11 @@ def execute(self, http_method, path, params=None, data=None, headers=None, allow
@return: The result of urllib2.urlopen()
"""
# Prepare URL and params
if urlencode:
path = urllib_quote(smart_str(path))

url = self._make_url(path, params)

if http_method in ("GET", "DELETE"):
if data is not None:
self.logger.warn("GET and DELETE methods do not pass any data. Path '%s'" % path)
Expand Down Expand Up @@ -226,8 +227,7 @@ def execute(self, http_method, path, params=None, data=None, headers=None, allow
if resp.status_code >= 300:
resp.raise_for_status()
raise exceptions.HTTPError(response=resp)
# Cache request cookie for the next http_client call.
self._cookies = resp.cookies
self._cookies = resp.cookies # Cache request cookie for the next http_client call.
return resp
except (exceptions.ConnectionError,
exceptions.HTTPError,
Expand Down

0 comments on commit d2342a6

Please sign in to comment.