Skip to content

Cookie handling in adapters? #241

@rfestag

Description

@rfestag

I ran into an issue trying to update webmachine-test to support cookie sessions (ie, keeping track of all cookies set by the server and automatically responding with them to emulate what browsers do on multi-request tests). I assumed that, at some point in Webmachine's core logic, it would be converting the Set-Cookie header array to a string. It looks like that isn't the case...instead, the adapters appear to handle it as a special case.

Would it be better if set_cookie only worked with strings, and always just concatenated new cookies to the string? Or is there some reason why special handling is done in the adapters (

cookies = [response.headers['Set-Cookie'] || []].flatten
)? I'm happy to work around it in whatever way makes sense, but it seems to me that the values of headers are always strings, and we should probably consistently represent it that way in the core logic, rather than leaving it to adapters to know which headers could be "multi value" and format them correctly.

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