Complete the code to import the correct FastAPI class for creating the app.
from fastapi import [1] app = [1]()
The FastAPI class is used to create the app instance.
Complete the code to import the correct class for sending files in FastAPI.
from fastapi.responses import [1]
FileResponse is the class used to send files as responses in FastAPI.
Fix the error in the route to correctly return a file download response.
@app.get('/download') async def download_file(): return [1]('example.txt')
FileResponse must be used to return a file for download.
Fill both blanks to set a custom filename and media type for the file download.
@app.get('/download') async def download_file(): return FileResponse('example.txt', filename=[1], media_type=[2])
The filename parameter sets the download name, media_type sets the file type.
Fill all three blanks to add a custom header and use FileResponse correctly.
@app.get('/download') async def download_file(): headers = [1] return FileResponse('example.txt', filename=[2], headers=[3])
Headers must be a dictionary, filename a string, and headers passed as the headers argument.
