sending POST, getting GET in Tornado

41 views Asked by At

I have a question. I am using tornado web server. I have a main handler which gets a request, pre-procceses it, creates a new request, and sends it further to the worker. The code of sending a pre-processed new request further to the worker looks like this:

    async def send_reworked_request(self, preprocessed_request, endpoint_url):
        # Create an HTTP client instance
        http_client = AsyncHTTPClient()

        # Create a request to send the reworked request to the other handler
        request = tornado.httpclient.HTTPRequest(
            url=endpoint_url,
            method="POST",
            body=preprocessed_request,
            connect_timeout = 1800.00,
            request_timeout = 1800.00)

        try:
        # Send the request
            response = await http_client.fetch(request)
            return response
        except Exception as e:
            print("Error: %s" % e)

I am sending a POST request. I have get and post async functions at the worker. The request sent comes as a GET request with an empty body to the worker, and ends up not in the post method as I expect, but in the get one. I have also cought the remote_ip. It is always the same, it is coming 100% from my request.

Do you know what is happening???

0

There are 0 answers