test(talk): cover include_status + malformed-header paths; drop Content-Type from default headers
Addresses the missing-test and Content-Type points from the latest PR #741 review: - client/talk.py _talk_headers(): drop the manual `Content-Type: application/json`. httpx sets it automatically on requests that pass `json=`, and we no longer leak it onto bodyless GETs and DELETEs. - tests/client/talk/test_talk_api.py: - new `test_talk_list_participants_with_include_status` asserting `includeStatus=true` is forwarded. - new `test_talk_get_messages_invalid_last_given_header` covering the defensive try/except around the `X-Chat-Last-Given` parse — asserts the fallback `last_given=None` and that a warning is logged. - existing `test_talk_list_participants` extended to assert that `includeStatus` is *absent* by default. Unit tests: 13 → 15. Integration tests still 7/7. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
8f92a7ea29
commit
9614c0b361
@@ -33,11 +33,16 @@ class TalkClient(BaseNextcloudClient):
|
||||
_CHAT_BASE = "/ocs/v2.php/apps/spreed/api/v1/chat"
|
||||
|
||||
def _talk_headers(self) -> dict[str, str]:
|
||||
"""Standard OCS+JSON headers for spreed API calls."""
|
||||
"""Standard OCS+JSON headers for spreed API calls.
|
||||
|
||||
``Content-Type`` is intentionally omitted — httpx adds it
|
||||
automatically (and correctly) on requests that pass ``json=``,
|
||||
so setting it here would also leak it onto bodyless GETs and
|
||||
DELETEs.
|
||||
"""
|
||||
return {
|
||||
"OCS-APIRequest": "true",
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
# Conversations (rooms)
|
||||
|
||||
Reference in New Issue
Block a user