From c032b3c2d4ba669d229ded538256d0dabc2f7eb2 Mon Sep 17 00:00:00 2001 From: George Sibble Date: Mon, 4 Mar 2013 19:30:24 -0600 Subject: [PATCH] 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 --- src/main/resources/python/swagger.mustache | 18 ++++++++---------- src/main/resources/python3/swagger.mustache | 19 +++++++++---------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/main/resources/python/swagger.mustache b/src/main/resources/python/swagger.mustache index 7ea42914a86..5a6b6d981fd 100644 --- a/src/main/resources/python/swagger.mustache +++ b/src/main/resources/python/swagger.mustache @@ -44,17 +44,15 @@ class ApiClient: 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: - # 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 method in ['POST', 'PUT', 'DELETE']: if postData: headers['Content-type'] = 'application/json' diff --git a/src/main/resources/python3/swagger.mustache b/src/main/resources/python3/swagger.mustache index 7000827e0ba..808599f5bda 100644 --- a/src/main/resources/python3/swagger.mustache +++ b/src/main/resources/python3/swagger.mustache @@ -43,17 +43,16 @@ class ApiClient: 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: - # 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 method in ['POST', 'PUT', 'DELETE']: if postData: headers['Content-type'] = 'application/json'