From c2be7c87604972c75f5ee8f5794018c378e586d8 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 5 Mar 2021 16:27:51 -0800 Subject: web: respond to HTTP HEAD / (for uptime monitoring) Proper HTTP HEAD support for all endpoints would be better, but don't want to break CORS stuff by hacking it. --- fatcat_scholar/web.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fatcat_scholar/web.py b/fatcat_scholar/web.py index dce732b..a268bf8 100644 --- a/fatcat_scholar/web.py +++ b/fatcat_scholar/web.py @@ -84,6 +84,13 @@ api = APIRouter() async def home() -> Any: return {"endpoints": {"/": "this", "/search": "fulltext search"}} +@api.head("/", include_in_schema=False) +async def root_head() -> Any: + """ + HTTP HEAD only for the root path. Requested by, eg, uptime monitoring + tools. This is distinct from the CORS middleware. + """ + return Response() class HitsModel(BaseModel): count_returned: int -- cgit v1.2.3