def filter()

in apisix/plugins/stop.py [0:0]


    def filter(self, conf: Any, request: Request, response: Response):
        """
        The plugin executes the main function
        :param conf:
            plugin configuration after parsing
        :param request:
            request parameters and information
        :param response:
            response parameters and information
        :return:
        """

        # print plugin configuration
        print(conf)

        # Fetch request nginx variable `host`
        host = request.get_var("host")
        print(host)

        # Fetch request body
        body = request.get_body()
        print(body)

        # Set response headers
        response.set_header("X-Resp-A6-Runner", "Python")

        # Set response body
        response.set_body("Hello, Python Runner of APISIX")

        # Set response status code
        response.set_status_code(201)