fastapi-crudrouter icon indicating copy to clipboard operation
fastapi-crudrouter copied to clipboard

Overriding GET route does not properly remove existing route

Open hjoukl opened this issue 1 year ago • 0 comments

Just stumbled upon this (and admit I haven't actually tested it yet, apologies for that) but it looks like CRUDGenerator.get would not properly remove its existing GET route when overriding it:

https://github.com/awtkns/fastapi-crudrouter/blob/9b829865d85113a3f16f94c029502a9a584d47bb/fastapi_crudrouter/core/_base.py#L149

Looks like a typo to me - shouldn't it rather be "GET" instead of "Get" here?

The corresponding removal code compares to route.methods and IIRC FastAPI does uppercase all the methods: https://github.com/awtkns/fastapi-crudrouter/blob/26702027aa0b823c105ee1b96e1b2b3f46a3b742/fastapi_crudrouter/core/_base.py#L170-L178

Best regards, Holger

hjoukl avatar Mar 29 '23 14:03 hjoukl