Let's see whether you can answer the following questions correctly:
- Which of the following methods allows us to set the HTTP status code for a response in a subclass of tornado.web.RequestHandler?
- self.write_status
- self.__cls__.write_status_code
- self.set_satus
- Which of the following methods allows us to write the response in a subclass of tornado.web.RequestHandler?
- self.write_response
- self.write
- self.set_response
- The main building blocks for a RESTful API in Tornado are subclasses of which of the following classes?
- tornado.web.GenericHandler
- tornado.web.RequestHandler
- tornado.web.IncomingHTTPRequestHandler
- If we just want to support the GET and PATCH methods, we can override the SUPPORTED_METHODS class variable with which of the following values?
- ("GET", "PATCH")
- {0: "GET", 1: "PATCH"}
- {"GET": True, "PATCH": True, "POST": False, "PUT": False}
- The list of tuples for the tornado.Web.Application constructor is composed of which of the following?
- A regular expression (regexp) and a tornado.web.RequestHandler subclass (request_class)
- A regular expression (regexp) and a tornado.web.GenericHandler subclass (request_class)
- A regular expression (regexp) and a tornado.web.IncomingHTTPRequestHandler subclass (request_class)
- When we call the self.write method with a dictionary as an argument in a request handler, Tornado:
- Automatically writes the chunk as JSON but we have to manually set the value of the Content-Type header to application/json
- Requires us to use the json.dumps method and set the value of the Content-Type header to application/json
- Automatically writes the chunk as JSON and sets the value of the Content-Type header to application/json
- A calls to the tornado.escape.json_decode method with self.request.body as an argument in a request handler:
- Generates Python objects for the JSON string of the request body and returns the generated tuple
- Generates Python objects for the JSON string of the request body and returns the generated dictionary
- Generates Python objects for the JSON string of the request body and returns the generated list