The request component holds all the information related to the current request. Json, Forms, Files everything can be accessed through it.
from vibora import Vibora, Request
from vibora.responses import JsonResponse
app = Vibora()
values =await request.json()
Note that request.json() is actually a coroutine that needs to be awaited, this design prevents the entire JSON being uploaded in-memory before the route requires it.
Uploaded files by multipart forms can be accessed by field name in request.form or through the request.files list. Both methods are co-routines that will consume the request.stream and store the file in-disk if it's too big to keep in-memory.
You can control the memory/disk usage of uploaded files by calling request.load_form(threshold=1 * 1024 * 1024) explicitly, in this case files bigger than 1mb will be flushed to disk.
Please be aware that the form threshold does not passthrough the max_body_size limit so you'll still need to configure your route properly.
Instead of pre-parsing the entire form you could call request.stream_form() and deal with every uploaded field as it arrives by the network. This is good when you don't want files hitting the disk and in some scenarios allows you to waste less memory by doing way more coding yourself.