Move URL Query Parameters into All HTTP Verbs

HTTP Spec states that URL query parameters can be in all verbs.  Should probably check all languages to make sure that query parameters are always passed even if it is not a GET call.

Signed-off-by: George Sibble <gsibble@gmail.com>
This commit is contained in:
George Sibble 2013-03-04 19:30:24 -06:00
parent 68ce5d78f9
commit c032b3c2d4
2 changed files with 17 additions and 20 deletions

View File

@ -44,17 +44,15 @@ class ApiClient:
data = None data = None
if method == 'GET': if queryParams:
# Need to remove None values, these should not be sent
sentQueryParams = {}
for param, value in queryParams.items():
if value != None:
sentQueryParams[param] = value
url = url + '?' + urllib.urlencode(sentQueryParams)
if queryParams: if method in ['POST', 'PUT', 'DELETE']:
# Need to remove None values, these should not be sent
sentQueryParams = {}
for param, value in queryParams.items():
if value != None:
sentQueryParams[param] = value
url = url + '?' + urllib.urlencode(sentQueryParams)
elif method in ['POST', 'PUT', 'DELETE']:
if postData: if postData:
headers['Content-type'] = 'application/json' headers['Content-type'] = 'application/json'

View File

@ -43,17 +43,16 @@ class ApiClient:
data = None data = None
if method == 'GET':
if queryParams:
# Need to remove None values, these should not be sent
sentQueryParams = {}
for param, value in queryParams.items():
if value != None:
sentQueryParams[param] = value
url = url + '?' + urllib.parse.urlencode(sentQueryParams)
if queryParams: if method in ['POST', 'PUT', 'DELETE']:
# Need to remove None values, these should not be sent
sentQueryParams = {}
for param, value in queryParams.items():
if value != None:
sentQueryParams[param] = value
url = url + '?' + urllib.parse.urlencode(sentQueryParams)
elif method in ['POST', 'PUT', 'DELETE']:
if postData: if postData:
headers['Content-type'] = 'application/json' headers['Content-type'] = 'application/json'