Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ NOTE: This class is auto generated by the swagger code generator program. Do not
"""
import sys
import os
import urllib

from models import *

Expand Down Expand Up @@ -78,6 +79,7 @@ class {{classname}}(object):
{{#pathParams}}
if ('{{paramName}}' in params):
replacement = str(self.apiClient.toPathValue(params['{{paramName}}']))
replacement = urllib.quote(replacement)
resourcePath = resourcePath.replace('{' + '{{baseName}}' + '}',
replacement)
{{/pathParams}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ class ApiClient(object):
string -- quoted value
"""
if type(obj) == list:
return urllib.quote(','.join(obj))
return ','.join(obj)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When calling the method toPathValue on the query parameters, the query parameters will be urlencoded.
But in swagger.mustache 60 line,

if queryParams:
      # Need to remove None values, these should not be sent
      sentQueryParams = {}
      for param, value in queryParams.items():
        if value is not None:
          sentQueryParams[param] = ApiClient.sanitizeForSerialization(value)
      url = url + '?' + urllib.urlencode(sentQueryParams)

will urlencode query parameters again.
The query parameter will be double urlencoded.

else:
return urllib.quote(str(obj))
return str(obj)

@staticmethod
def sanitizeForSerialization(obj):
Expand Down