MCPcopy Index your code
hub / github.com/hugapi/hug / gather_parameters

Method gather_parameters

hug/interface.py:721–757  ·  view source on GitHub ↗

Gathers and returns all parameters that will be used for this endpoint

(self, request, response, context, api_version=None, **input_parameters)

Source from the content-addressed store, hash-verified

719 return self._params_for_transform_state
720
721 def gather_parameters(self, request, response, context, api_version=None, **input_parameters):
722 """Gathers and returns all parameters that will be used for this endpoint"""
723 input_parameters.update(request.params)
724
725 if self.parse_body and request.content_length:
726 body = request.bounded_stream
727 content_type, content_params = parse_content_type(request.content_type)
728 body_formatter = body and self.inputs.get(
729 content_type, self.api.http.input_format(content_type)
730 )
731 if body_formatter:
732 body = body_formatter(body, content_length=request.content_length, **content_params)
733 if "body" in self.all_parameters:
734 input_parameters["body"] = body
735 if isinstance(body, dict):
736 input_parameters.update(body)
737 elif "body" in self.all_parameters:
738 input_parameters["body"] = None
739
740 if "request" in self.all_parameters:
741 input_parameters["request"] = request
742 if "response" in self.all_parameters:
743 input_parameters["response"] = response
744 if "api_version" in self.all_parameters:
745 input_parameters["api_version"] = api_version
746 for parameter, directive in self.directives.items():
747 arguments = (self.defaults[parameter],) if parameter in self.defaults else ()
748 input_parameters[parameter] = directive(
749 *arguments,
750 response=response,
751 request=request,
752 api=self.api,
753 api_version=api_version,
754 context=context,
755 interface=self
756 )
757 return input_parameters
758
759 @property
760 def outputs(self):

Callers 2

__call__Method · 0.95
requestMethod · 0.80

Calls 4

parse_content_typeFunction · 0.90
directiveFunction · 0.85
input_formatMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected