Exemplo n.º 1
0
 async def get(self, request, args):
     return J(args)
Exemplo n.º 2
0
 async def get(self, request, name: str = "World"):
     return J({"name": name})
Exemplo n.º 3
0
async def echo_cookie(request):
    return J(await parser.parse(hello_args, request, location="cookies"))
Exemplo n.º 4
0
async def echo_path_param(request):
    parsed = await parser.parse({"path_param": fields.Int()},
                                request,
                                location="path_params")
    return J(parsed)
Exemplo n.º 5
0
async def echo_headers(request):
    # the "exclude schema" must be used in this case because WSGI headers may
    # be populated with many fields not sent by the caller
    return J(await parser.parse(hello_exclude_schema,
                                request,
                                location="headers"))
Exemplo n.º 6
0
async def error(request):
    def always_fail(value):
        raise ma.ValidationError("something went wrong")

    args = {"text": fields.Str(validate=always_fail)}
    return J(await parser.parse(args, request))
Exemplo n.º 7
0
async def echo_use_kwargs_with_path(request, value):
    return J({"value": value})
Exemplo n.º 8
0
async def echo_use_args_with_path(request, args):
    return J(args)
Exemplo n.º 9
0
async def many_nested(request):
    arguments = await parser.parse(hello_many_schema, request, location="json")
    return J(arguments)