def router(self):
        self.preprocess_request()

        try:
            data = request.form.to_dict()
            data.pop('extAction')
            data.pop('extMethod')
            data.pop('extType')
            data.pop('extUpload')
            data.pop('extTID')
            req = {
                'action': request.form['extAction'],
                'method': request.form['extMethod'],
                'type': request.form['extType'],
                'upload': request.form['extUpload'],
                'tid': request.form['extTID'],
                'data': data,
            }
            return json.dumps(self._request(req))
        except KeyError:
            requests = json.loads(request.data)

            if isinstance(requests, dict):
                requests = [requests]

            responses = []
            for req in requests:
                responses.append(self._request(req))

            if len(responses) == 1:
                responses = responses[0]

            return json.dumps(responses)
dataset/ETHPy150Open paparent/Flask-ExtDirect/flaskext/extdirect.py/ExtDirect.router/original