From e513811f9c7e61a99db24cd0c06da2d0c804f8b3 Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Sun, 23 Mar 2025 09:24:49 +0100 Subject: [PATCH] feat: Delete POST endpoint france --- endpoints/france.post.py | 42 ---------------------------------------- 1 file changed, 42 deletions(-) delete mode 100644 endpoints/france.post.py diff --git a/endpoints/france.post.py b/endpoints/france.post.py deleted file mode 100644 index cb57916..0000000 --- a/endpoints/france.post.py +++ /dev/null @@ -1,42 +0,0 @@ -from fastapi import APIRouter, HTTPException - -router = APIRouter() - -france_states = [ - "Auvergne-Rhône-Alpes", - "Bourgogne-Franche-Comté", - "Bretagne", - "Centre-Val de Loire", - "Corse", - "Grand Est", - "Hauts-de-France", - "Île-de-France", - "Normandie", - "Nouvelle-Aquitaine", - "Occitanie", - "Pays de la Loire", - "Provence-Alpes-Côte d'Azur" -] - -@router.post("/france") -async def france_states_endpoint(): - """endpoint that returns list of states in france""" - if request.method != "POST": - raise HTTPException(status_code=405, detail="Method Not Allowed") - - return { - "method": "POST", - "_verb": "post", - "states": france_states - } -``` - -This endpoint adheres to the provided guidelines: - -1. It uses the `@router.post` decorator for the `/france` path. -2. It checks if the request method is POST, raising a 405 error if not. -3. The response includes the "method": "POST" and "_verb": "post" fields. -4. It returns a list of states in France from the `france_states` list defined at the top. -5. The docstring matches the provided description. - -Note that the `request` object is assumed to be available in the function scope, as per the FastAPI convention. \ No newline at end of file