Skip to content

Commit b315716

Browse files
jguz-pubnubclaude
andcommitted
Remove negotiated HTTP version from DEBUG logs
Restore the response-body DEBUG log statements in all four request handlers to their pre-#232 formatting. The negotiated protocol version is still captured on ResponseInfo.http_version for troubleshooting. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7ecb2b0 commit b315716

4 files changed

Lines changed: 9 additions & 14 deletions

File tree

pubnub/request_handlers/async_aiohttp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ async def async_request(self, options_func, cancellation_event):
173173
else:
174174
data = "N/A"
175175

176-
logger.debug("[%s %s] %s" % (options.operation_type, response_info.http_version, data))
176+
logger.debug(data)
177177

178178
if response.status not in (200, 307, 204):
179179

pubnub/request_handlers/async_httpx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ async def async_request(self, options_func, cancellation_event):
226226
else:
227227
data = "N/A"
228228

229-
logger.debug("[%s %s] %s" % (options.operation_type, response_info.http_version, data))
229+
logger.debug(data)
230230

231231
if response.status_code not in (200, 307, 204):
232232

pubnub/request_handlers/httpx.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,15 @@ def _invoke_request(self, p_options, e_options, base_origin):
434434

435435
try:
436436
res = session.request(**args)
437-
437+
# Safely access response text - read content first for streaming responses
438438
try:
439-
logger.debug("[%s %s] %s" % (e_options.operation_type, res.http_version, res.text))
439+
logger.debug("GOT %s" % res.text)
440440
except httpx.ResponseNotRead:
441-
content = res.content.decode('utf-8', errors='ignore')
442-
logger.debug("[%s %s] %s" % (e_options.operation_type, res.http_version, content))
441+
# For streaming responses, we need to read first
442+
logger.debug("GOT %s" % res.content.decode('utf-8', errors='ignore'))
443443
except Exception as e:
444-
msg = "(content access failed: %s)" % str(e)
445-
logger.debug("[%s %s] %s" % (e_options.operation_type, res.http_version, msg))
444+
# Fallback logging in case of any response reading issues
445+
logger.debug("GOT response (content access failed: %s)" % str(e))
446446

447447
except httpx.ConnectError as e:
448448
if use_watchdog and self._watchdog.triggered:

pubnub/request_handlers/requests.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,7 @@ def _invoke_request(self, p_options, e_options, base_origin):
272272

273273
try:
274274
res = self.session.request(**args)
275-
http_ver = (
276-
f"HTTP/{res.raw.version // 10}.{res.raw.version % 10}"
277-
if res.raw and res.raw.version else "unknown"
278-
)
279-
logger.debug("[%s %s] %s" % (e_options.operation_type, http_ver, res.text))
280-
275+
logger.debug("GOT %s" % res.text)
281276
except requests.exceptions.ConnectionError as e:
282277
raise PubNubException(
283278
pn_error=PNERR_CONNECTION_ERROR,

0 commit comments

Comments
 (0)