File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,13 @@ public function __construct(
63
63
$ this ->response = $ response ;
64
64
$ this ->paginationHandler = $ paginationHandler ;
65
65
66
- $ this ->contents = $ this ->response ->getBody ()->getContents ();
66
+ $ this ->contents = (string ) $ this ->response ->getBody ();
67
+
68
+ /**
69
+ * Now we've fetched the contents, rewind the stream to ensure anyone fetching the PSR-7 response
70
+ * can read the body correctly without having to rewind first.
71
+ */
72
+ $ this ->response ->getBody ()->rewind ();
67
73
}
68
74
69
75
public function toPsr7Request (): RequestInterface
@@ -73,9 +79,6 @@ public function toPsr7Request(): RequestInterface
73
79
74
80
public function toPsr7Response (): ResponseInterface
75
81
{
76
- // Ensure the body is rewound so the consumer can read the contents of the body if they want to.
77
- $ this ->response ->getBody ()->rewind ();
78
-
79
82
return $ this ->response ;
80
83
}
81
84
You can’t perform that action at this time.
0 commit comments