code: def inject_extra_args(callback, request, kwargs):
      '''Inject extra arguments from header, body, form.'''
      # TODO: this is a temporary pach, should be managed via honouring the
      # mimetype in the request header....
      annots = dict(callback.__annotations__)
      del annots['return']
      for param_name, (param_type, _) in annots.items():
          if param_type == Ptypes.path:
              continue  # Already parsed by werkzeug
          elif param_type == Ptypes.body:
              value = getattr(request, PTYPE_TO_REQUEST_PROPERTY[param_type])
              # TODO: The JSON conversion should be dependant from request
              # header type, really...
              value = json.loads(value.decode('utf-8'))
          else:
              get = lambda attr: getattr(request, attr).get(param_name, None)
              value = get(PTYPE_TO_REQUEST_PROPERTY[param_type])
          if value is not None:
              kwargs[param_name] = valuf inject_extra_args(callback, request, kwargs):
      '''Inject extra arguments from header, body, form.'''
      # TODO: this is a temporary pach, should be managed via honouring the
      # mimetype in the request header....
      annots = dict(callback.__annotations__)
      del annots['return']
      for param_name, (param_type, _) in annots.items():
          if param_type == Ptypes.path:
              continue  # Already parsed by werkzeug
          elif param_type == Ptypes.body:
              value = getattr(request, PTYPE_TO_REQUEST_PROPERTY[param_type])
              # TODO: The JSON conversion should be dependant from request
              # header type, really...
              value = json.loads(value.decode('utf-8'))
          else:
              get = lambda attr: getattr(request, attr).get(param_name, None)
              value = get(PTYPE_TO_REQUEST_PROPERTY[param_type])
          if value is not None:
              kwargs[param_name] = value
docs: Inject extra arguments from header, body, form.