41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
from fastapi import APIRouter, Request, Response
|
|
|
|
test_template_route = APIRouter(prefix="/test", tags=["Test"])
|
|
|
|
|
|
@test_template_route.get(path="/template", description="Test Template Route")
|
|
def test_template(request: Request, response: Response):
|
|
"""
|
|
Test Template Route
|
|
"""
|
|
headers = dict(request.headers)
|
|
response.headers["X-Header"] = "Test Header GET"
|
|
return {
|
|
"completed": True,
|
|
"message": "Test Template Route",
|
|
"info": {
|
|
"host": headers.get("host", "Not Found"),
|
|
"user_agent": headers.get("user-agent", "Not Found"),
|
|
},
|
|
}
|
|
|
|
|
|
@test_template_route.post(
|
|
path="/template",
|
|
description="Test Template Route with Post Method",
|
|
)
|
|
def test_template_post(request: Request, response: Response):
|
|
"""
|
|
Test Template Route with Post Method
|
|
"""
|
|
headers = dict(request.headers)
|
|
response.headers["X-Header"] = "Test Header POST"
|
|
return {
|
|
"completed": True,
|
|
"message": "Test Template Route with Post Method",
|
|
"info": {
|
|
"host": headers.get("host", "Not Found"),
|
|
"user_agent": headers.get("user-agent", "Not Found"),
|
|
},
|
|
}
|