We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ddbe8ab commit 99a8c45Copy full SHA for 99a8c45
main.py
@@ -1,12 +1,13 @@
1
import os
2
3
-from fastapi import FastAPI
+from fastapi import FastAPI, Request
4
5
app = FastAPI()
6
7
8
-@app.get("/")
9
-def read_root():
+@app.get("/api")
+def read_root(request: Request):
10
# list all env vars starting with HELLO-
11
hello_env_vars = {k: v for k, v in os.environ.items() if k.startswith("HELLO_")}
12
- return {"message": "Hello, World!", "envs": hello_env_vars}
+ headers = dict(request.headers)
13
+ return {"message": "Hello, World!", "envs": hello_env_vars, "headers": headers}
0 commit comments