Skip to content

Commit 9fe1d32

Browse files
committed
Document http interface's need for urlencode(dict)
This is to accomondate existing customers who accidentally depend on such behavior. It also documents the future direction of using an already-encoded string, so that such expectation is clear in this first release of this http interface. In the future, when we switch existing dict behavior to string behavior, it won't be considered as a breaking change.
1 parent 85cd08c commit 9fe1d32

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

oauth2cli/http.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ class HttpClient(object):
1111
def post(self, url, params=None, data=None, headers=None, **kwargs):
1212
"""HTTP post.
1313
14-
params, data and headers MUST accept a dictionary.
14+
:param dict params: A dict to be url-encoded and sent as query-string.
15+
:param dict headers: A dict representing headers to be sent via request.
16+
:param data:
17+
Implementation needs to support 2 types.
18+
19+
* A dict, which will need to be urlencode() before being sent.
20+
* (Recommended) A string, which will be sent in request as-is.
21+
1522
It returns an :class:`~Response`-like object.
1623
1724
Note: In its async counterpart, this method would be defined as async.
@@ -21,7 +28,9 @@ def post(self, url, params=None, data=None, headers=None, **kwargs):
2128
def get(self, url, params=None, headers=None, **kwargs):
2229
"""HTTP get.
2330
24-
params, data and headers MUST accept a dictionary.
31+
:param dict params: A dict to be url-encoded and sent as query-string.
32+
:param dict headers: A dict representing headers to be sent via request.
33+
2534
It returns an :class:`~Response`-like object.
2635
2736
Note: In its async counterpart, this method would be defined as async.

0 commit comments

Comments
 (0)