Bug Description
Introduced in this PR, when instantiating an HttpPlugin with a server_factory, self._server is overwritten in a check that is only intended to ensure that the server's port and the port on the class are aligned.
Steps to Reproduce
Run this code, observe that the custom server factory is called but the server instance custom_http_plugin._server has been overwritten by this else block.
In my case, I noticed this by attempting to specify proxy_headers=False without success.
import uvicorn
from fastapi import FastAPI
from microsoft_teams.apps.http_plugin import HttpPlugin
def custom_server_factory(app: FastAPI) -> uvicorn.Server:
print('Creating custom server!')
return uvicorn.Server(config=uvicorn.Config(app, host='0.0.0.0', port=80, proxy_headers=False))
custom_http_plugin = HttpPlugin(server_factory=custom_server_factory)
app = App(plugins=[custom_http_plugin])
Expected Behavior
The server created by the server_factory should be used and not overwritten.
Actual Behavior
The server created by the server_factory was overwritten.
SDK Version
2.0.0a9
Python Version
3.12.3
Additional Context
No response
Bug Description
Introduced in this PR, when instantiating an
HttpPluginwith aserver_factory,self._serveris overwritten in a check that is only intended to ensure that the server's port and the port on the class are aligned.Steps to Reproduce
Run this code, observe that the custom server factory is called but the server instance
custom_http_plugin._serverhas been overwritten by this else block.In my case, I noticed this by attempting to specify
proxy_headers=Falsewithout success.Expected Behavior
The server created by the
server_factoryshould be used and not overwritten.Actual Behavior
The server created by the
server_factorywas overwritten.SDK Version
2.0.0a9
Python Version
3.12.3
Additional Context
No response