diff --git a/3940/_sources/migration/flask.rst.txt b/3940/_sources/migration/flask.rst.txt
index a12c8a372..3b439ceb3 100644
--- a/3940/_sources/migration/flask.rst.txt
+++ b/3940/_sources/migration/flask.rst.txt
@@ -202,11 +202,11 @@ Request methods
+---------------------------------+-------------------------------------------------------------------------------------------------------+
| ``request.environ`` | ``request.scope`` |
+---------------------------------+-------------------------------------------------------------------------------------------------------+
-| ``request.files`` | Use ```UploadFile`` Request methodsrequest.scope
request.files
Use `UploadFile
<usage/requests/file-uploads>`__
Use UploadFile
see in Requests
request.form
request.form()
, prefer `Body
<usage/requests/content-type>`__
request.form()
, prefer Body
see in Requests
request.get_json
request.json()
, prefer the `data keyword argument
<usage/requests/request-body>`__
request.json()
, prefer the data
keyword argument, see in Requests
request.headers
request.headers
from litestar import Litestar
-from litestar.static_files import StaticFilesConfig
+from litestar.static_files import create_static_files_router
-app = Litestar(
- [], static_files_config=[StaticFilesConfig(path="/static", directories=["static"])]
-)
+ app = Litestar route_handlers=[
+ create_static_files_router(path="/static", directories=["assets"]),
+ ])
The default OpenAPI config used if not configuration is explicitly passed to the
Litestar
instance constructor.
Initialize a Litestar
application.
Create a Litestar app instance and initializes it.
AsyncTestClient
with it.
Create a Litestar app instance and initializes it.
TestClient
with it.
Run it
> curl http://127.0.0.1:8000/users -H Content-Type: application/json -d {"userName":"Litestar User","password":"xyz","created_at":"2023-04-24T00:00:00Z"}
-{"created_at":"0001-01-01T00:00:00","id":"9b02b13b-e972-4126-8c19-f5497ad98c41","userName":"Litestar User"}
+{"created_at":"0001-01-01T00:00:00","id":"ad34842c-85a3-4028-97e6-3bfc984823fa","userName":"Litestar User"}
Run it
> curl http://127.0.0.1:8000/users -H Content-Type: application/json -d {"name":"Litestar User","password":"xyz","created_at":"2023-04-24T00:00:00Z"}
-{"created_at":"0001-01-01T00:00:00","id":"f1fc7dcd-e668-46eb-b16c-77a718d7b36b","name":"Litestar User"}
+{"created_at":"0001-01-01T00:00:00","id":"40eadd9b-eab5-41b6-9291-f9bebe334376","name":"Litestar User"}
Run it
> curl http://127.0.0.1:8000/users -H Content-Type: application/json -d {"name":"Litestar User","password":"xyz","created_at":"2023-04-24T00:00:00Z"}
-{"id":"98f5c37b-55b9-4be9-bbe7-23ac835c49cc","name":"Litestar User","password":"xyz","created_at":"2023-04-24T00:00:00Z"}
+{"id":"18a91dcc-2ecc-44c1-a625-c5c9fdf15fd2","name":"Litestar User","password":"xyz","created_at":"2023-04-24T00:00:00Z"}
Run it
> curl http://127.0.0.1:8000/users -H Content-Type: application/json -d {"name":"Litestar User","password":"xyz","created_at":"2023-04-24T00:00:00Z"}
-{"created_at":"0001-01-01T00:00:00","id":"68494671-d283-46df-9ff5-2ab81063159b","name":"Litestar User"}
+{"created_at":"0001-01-01T00:00:00","id":"7dcce275-dede-4df9-9b68-dadd1813d890","name":"Litestar User"}
Run it
> curl http://127.0.0.1:8000/users -H Content-Type: application/json -d {"userName":"Litestar User","password":"xyz","created_at":"2023-04-24T00:00:00Z"}
-{"created_at":"0001-01-01T00:00:00","id":"79f9a0bb-5ff9-44a4-ad9d-f87d2324731b","userName":"Litestar User"}
+{"created_at":"0001-01-01T00:00:00","id":"bcc13a47-16e8-4827-91e0-588e98b3efbb","userName":"Litestar User"}
Run it
> curl http://127.0.0.1:8000/users -H Content-Type: application/json -d {"firstName":"Litestar User","password":"xyz","createdAt":"2023-04-24T00:00:00Z"}
-{"createdAt":"0001-01-01T00:00:00","id":"8a732d3c-3807-4e9b-9cb5-9bd16b7ac1d6","firstName":"Litestar User"}
+{"createdAt":"0001-01-01T00:00:00","id":"7a20722d-5de0-44fa-a792-16fc54877422","firstName":"Litestar User"}
Run it
> curl http://127.0.0.1:8000/users -H Content-Type: application/json -d {"name":"Peter","email": "peter@example.com", "age":41}
-{"name":"Peter","email":"peter@example.com","age":41,"id":"04a6bc91-48a4-48f4-9a89-a464c8d96c8d"}
+{"name":"Peter","email":"peter@example.com","age":41,"id":"a7d71abd-b630-4fa8-b1ad-e28b7d3cb6a7"}
Run it
> curl http://127.0.0.1:8000/users -H Content-Type: application/json -d {"name":"Peter", "email": "peter@example.com", "age":41}
-{"name":"Peter","email":"peter@example.com","age":41,"id":"f036881f-2c92-47fd-80da-bd99c50b205d"}
+{"name":"Peter","email":"peter@example.com","age":41,"id":"86f01890-c7af-48ea-8674-b3c80fcaf285"}