Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion httpie/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@


def is_anonymous_session(session_name: str) -> bool:
return os.path.sep in session_name
return os.path.sep in session_name or bool(os.path.altsep and os.path.altsep in session_name)


def session_hostname_to_dirname(hostname: str, session_name: str) -> str:
Expand Down
8 changes: 8 additions & 0 deletions tests/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,3 +850,11 @@ def test_secure_cookies_on_localhost(mock_env, tmp_path, server, expected_cookie
server + '/cookies'
)
assert r.json == {'cookies': expected_cookies}


def test_is_anonymous_session_cross_platform():
from httpie.sessions import is_anonymous_session
assert is_anonymous_session('custom/path/session.json')
assert is_anonymous_session('custom\\path\\session.json')
assert not is_anonymous_session('my_named_session')

Loading