alexschimpf / fastapi-versionizer

FastAPI Versionizer
MIT License
79 stars 13 forks source link

fix: Fixed middleware stack #42

Closed aemr3 closed 10 months ago

aemr3 commented 10 months ago

Middlewares are not working with the latest updates. I added a test to demonstrate the problem.

Fixed it by re-passing user_middleware attribute to cloned_app. Btw, if you add middlewares to versioned app it was working. But if you add middlewares before versioning the app it wasn't working.

I suspect there maybe other issues with dependency_overrides or exception_handlers. Not sure yet.

cc: @alexschimpf (Sorry for the commit messages not following your linting standards)

alexschimpf commented 10 months ago

:tada: This PR is included in version 2.1.5 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

alexschimpf commented 10 months ago

@aemr3 I made a PR that goes back to modifying the FastAPI object in place, instead of trying to hackily clone it. This should ensure that all properties of your FastAPI are properly preserved.

https://github.com/alexschimpf/fastapi-versionizer/pull/43/files

aemr3 commented 10 months ago

@aemr3 I made a PR that goes back to modifying the FastAPI object in place, instead of trying to hackily clone it. This should ensure that all properties of your FastAPI are properly preserved.

https://github.com/alexschimpf/fastapi-versionizer/pull/43/files

Cool, thanks. I will test it soon. It looks better this way.