Skip to content

Commit

Permalink
Merge pull request #40 from chrised/support_multiple_parameters_in_path
Browse files Browse the repository at this point in the history
Allow multiple parameters in a path
  • Loading branch information
Dorthu committed Mar 18, 2021
2 parents 828267a + 6b0d17b commit e337b42
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion openapi3/paths.py
Expand Up @@ -188,6 +188,7 @@ def _request_handle_secschemes(self, security_requirement, value):

def _request_handle_parameters(self, parameters={}):
# Parameters
path_parameters = {}
accepted_parameters = {}
p = self.parameters + self._root.paths[self.path[-2]].parameters

Expand All @@ -206,7 +207,10 @@ def _request_handle_parameters(self, parameters={}):
continue

if spec.in_ == 'path':
self._request.url = self._request.url.format(**{name: value})
# The string method `format` is incapable of partial updates,
# as such we need to collect all the path parameters before
# applying them to the format string.
path_parameters[name] = value

if spec.in_ == 'query':
self._request.params[name] = value
Expand All @@ -217,6 +221,8 @@ def _request_handle_parameters(self, parameters={}):
if spec.in_ == 'cookie':
self._request.cookies[name] = value

self._request.url = self._request.url.format(**path_parameters)

def _request_handle_body(self, data):
if 'application/json' in self.requestBody.content:
if isinstance(data, dict) or isinstance(data, list):
Expand Down

0 comments on commit e337b42

Please sign in to comment.