Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Deleting the session logs a warning if the server responds with HTTP 204 #696

Copy link
Copy link
@nbarbettini

Description

@nbarbettini
Issue body actions

Describe the bug
When sending an HTTP DELETE request to end the current session, this client SDK will log a warning if the server responds with 204 instead of 200:

elif response.status_code != 200:
logger.warning(f"Session termination failed: {response.status_code}")

HTTP 204 is an acceptable status code for a DELETE that has no response payload.

To Reproduce
Given this simple client:

async def run():
    # Connect to a streamable HTTP server
    async with streamablehttp_client(
        "<server_url>",
        headers=headers,
    ) as (
        read_stream,
        write_stream,
        _,
    ):
        # Create a session using the client streams
        async with ClientSession(read_stream, write_stream) as session:
            # Initialize the connection
            await session.initialize()

            # List available tools
            tools = await session.list_tools()

Running it produces:

❯ python main.py
Session termination failed: 204

Expected behavior
No warning. 204 is the correct response code to return for a body-less response, per RFC 7231.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.