Skip to content

Commit 1acd392

Browse files
committed
dont try read body of no_content resp
1 parent 6c33451 commit 1acd392

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

adafruit_requests.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,10 @@ def content(self) -> bytes:
300300
return self._cached
301301
raise RuntimeError("Cannot access content after getting text or json")
302302

303-
self._cached = b"".join(self.iter_content(chunk_size=32))
303+
if self.status_code != 204:
304+
self._cached = b"".join(self.iter_content(chunk_size=32))
305+
else:
306+
self._cached = b""
304307
return self._cached
305308

306309
@property

0 commit comments

Comments
 (0)