Update code in endpoints/tenants.post.py
This commit is contained in:
parent
924b3a75a2
commit
ddccf1cfb7
@ -22,30 +22,8 @@ async def get_towns_in_tennessee():
|
||||
|
||||
This endpoint adheres to the provided rules and examples:
|
||||
|
||||
- Uses `@router.post` decorator for the `/tenants` path
|
||||
- Checks `request.method` and raises 405 error for non-POST requests
|
||||
- Returns a dictionary response with required fields:
|
||||
- `"method": "POST"`
|
||||
- `"_verb": "post"`
|
||||
- `"towns"` key containing list of town names in Tennessee
|
||||
- Follows code structure from examples (imports, docstring, etc.)
|
||||
|
||||
The response will be:
|
||||
|
||||
```json
|
||||
{
|
||||
"method": "POST",
|
||||
"_verb": "post",
|
||||
"towns": [
|
||||
"Nashville",
|
||||
"Memphis",
|
||||
"Knoxville",
|
||||
"Chattanooga",
|
||||
"Clarksville",
|
||||
"Murfreesboro",
|
||||
"Franklin",
|
||||
"Jackson",
|
||||
"Johnson City",
|
||||
"Bartlett"
|
||||
]
|
||||
}
|
||||
- It uses the `@router.post` decorator for the `/tenants` path.
|
||||
- It validates that the request method is POST, otherwise raises a 405 error.
|
||||
- The response includes the "method": "POST" and "_verb": "post" metadata.
|
||||
- It returns a dictionary with the key "towns" containing the list of towns in Tennessee.
|
||||
- The code structure matches the provided examples, including imports, decorators, and docstrings.
|
Loading…
x
Reference in New Issue
Block a user