From 8a4735113477eb2f06340d1dc2ebf82edc143926 Mon Sep 17 00:00:00 2001 From: star7js <126814341+star7js@users.noreply.github.com> Date: Tue, 10 Nov 2026 20:30:30 -0700 Subject: [PATCH] [Confluence] ConfluenceCloud: get_page_by_id(get_body=False) no longer sends body-format=none "none" is not a valid body-format for GET /api/v2/pages/{id}, so Confluence answered 400. Leave body-format out instead, which returns the page without a body. get_body=False still takes precedence over body_format. Fixes #1718 --- atlassian/confluence/cloud/cloud.py | 4 +++- tests/test_confluence_v2.py | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/atlassian/confluence/cloud/cloud.py b/atlassian/confluence/cloud/cloud.py index 448c7eb6b..b1eff7897 100644 --- a/atlassian/confluence/cloud/cloud.py +++ b/atlassian/confluence/cloud/cloud.py @@ -153,7 +153,9 @@ def get_page_by_id( params["body-format"] = body_format if not get_body: - params["body-format"] = "none" + # "none" is not a valid body-format and Confluence answers 400. + # Leaving body-format out returns the page without a body. + params.pop("body-format", None) if expand: params["expand"] = ",".join(expand) diff --git a/tests/test_confluence_v2.py b/tests/test_confluence_v2.py index dce678e95..427e54814 100644 --- a/tests/test_confluence_v2.py +++ b/tests/test_confluence_v2.py @@ -51,9 +51,17 @@ def test_get_page_by_id_without_body(self, mock_get): response = self.confluence_v2.get_page_by_id("123", get_body=False) # Assertions - mock_get.assert_called_once_with("api/v2/pages/123", params={"body-format": "none"}) + mock_get.assert_called_once_with("api/v2/pages/123", params={}) self.assertEqual(response, mock_response) + @patch("atlassian.confluence.cloud.ConfluenceCloud.get") + def test_get_page_by_id_without_body_ignores_body_format(self, mock_get): + mock_get.return_value = {"id": "123", "title": "Test Page"} + + self.confluence_v2.get_page_by_id("123", body_format="storage", get_body=False) + + mock_get.assert_called_once_with("api/v2/pages/123", params={}) + @patch("atlassian.confluence.cloud.ConfluenceCloud.get") def test_get_page_versions(self, mock_get): mock_response = {"results": [{"number": 2}]}