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