Describe the bug
When using urllib url joining, this truncates server urls paths when combining /messages/ set in the transport object.
sse = SseServerTransport("/messages/")
For example, if joining http://localhost:8000/some/path/to/sse with /messages/, it will output: http://localhost:8000/messages/ instead of honoring the path.
Removing the leading slash fixes this.
This was found in the situation where my server was being proxied and accessed at a subpath. afaict, there is no explicit reason to keep the leading slash. This is also something that could be addressed in #194 since a dev could then customize the server setup more easily.
To Reproduce
from urllib.parse import urljoin
url = "http://localhost:8000/some/path/to/sse"
sse_data = "/messages/?session_id=123"
endpoint_url = urljoin(url, sse_data)
assert endpoint_url == "http://localhost:8000/messages/?session_id=123"
####
url = "http://localhost:8000/some/path/to/sse"
sse_data = "messages/?session_id=123"
endpoint_url = urljoin(url, sse_data)
assert endpoint_url == "http://localhost:8000/some/path/to/messages/?session_id=123"
Expected behavior
A clear and concise description of what you expected to happen.
I would expect this to join the route to the end of the url instead of truncating it.
Describe the bug
When using urllib url joining, this truncates server urls paths when combining
/messages/set in the transport object.For example, if joining
http://localhost:8000/some/path/to/ssewith/messages/, it will output:http://localhost:8000/messages/instead of honoring the path.Removing the leading slash fixes this.
This was found in the situation where my server was being proxied and accessed at a subpath. afaict, there is no explicit reason to keep the leading slash. This is also something that could be addressed in #194 since a dev could then customize the server setup more easily.
To Reproduce
Expected behavior
A clear and concise description of what you expected to happen.
I would expect this to join the route to the end of the url instead of truncating it.