Skip to content

Commit e804dfc

Browse files
committed
proper encoding of query param
1 parent afc3021 commit e804dfc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/swagger.coffee

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class SwaggerOperation
276276
if param.paramType == 'path'
277277

278278
if args[param.name]
279-
url = url.replace("{#{param.name}}", args[param.name])
279+
url = url.replace("{#{param.name}}", encodeURIComponent(args[param.name]))
280280
delete args[param.name]
281281
else
282282
throw "#{param.name} is a required path param."
@@ -310,10 +310,12 @@ class SwaggerOperation
310310
getMatchingParams: (paramTypes, args, includeApiKey) ->
311311
matchingParams = {}
312312
for param in @parameters
313-
matchingParams[param.name] = args[param.name] if jQuery.inArray(param.paramType, paramTypes) and args[param.name]
313+
if (jQuery.inArray(param.paramType, paramTypes) >= 0) and args[param.name]
314+
matchingParams[param.name] = args[param.name]
314315

315-
#maMchingParams API key to the params
316-
matchingParams['api_key'] = @resource.api.api_key if includeApiKey and @resource.api.api_key? and @resource.api.api_key.length > 0
316+
#machingParams API key to the params
317+
if includeApiKey and @resource.api.api_key? and @resource.api.api_key.length > 0
318+
matchingParams['api_key'] = @resource.api.api_key
317319

318320
matchingParams
319321

0 commit comments

Comments
 (0)