示例#1
0
 def view(request: Request):
     return response(request).json(
         {
             "object": CustomObject(),
         },
         default=_default,
     )
示例#2
0
 def view(request: Request):
     return response(request).json(
         {
             "object": CustomObject(),
         },
         encoder_class=_JsonEncoder,
     )
示例#3
0
 def view(request: Request):
     return response(request,
                     201).json({"user": {
                         "details": {
                             "name": "root"
                         }
                     }},
                               indent=4)
示例#4
0
 def view(request: Request):
     return response(request).html("<b>html text</b>")
示例#5
0
 def view(request: Request):
     return response(request).send_file(pathlib.Path(file_path),
                                        file_name="file.bin",
                                        inline=True)
示例#6
0
 def view(request: Request):
     return response(request).back()
示例#7
0
 def view(request: Request):
     return response(request).back({"user": "******"})
示例#8
0
 def view(request: Request):
     return response(request).text("plain text response")
示例#9
0
 def view(request: Request):
     return response(request).template(template_path, {"username": "******"})
示例#10
0
 def view(request: Request):
     return response(request).stream(numbers(),
                                     media_type="text/plain",
                                     file_name="numbers.txt",
                                     inline=True)
示例#11
0
 def view(request: Request):
     return response(request).stream(numbers())
示例#12
0
 def view(request: Request):
     return response(request).send_file(file_path, file_name="file.bin")
示例#13
0
 def view(request: Request):
     return response(request).redirect("profile")
示例#14
0
 def view(request: Request):
     return response(request).redirect("/about")
示例#15
0
 def view(request: Request):
     return response(request, 201).json({"user": "******"})