Skip to content

Commit 3d07422

Browse files
CopilotThavarshan
andcommitted
Fix code review comments: improve docblock and JSON validation
Co-authored-by: Thavarshan <10804999+Thavarshan@users.noreply.github.com>
1 parent c29537f commit 3d07422

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/Fetch/Concerns/PerformsHttpRequests.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ protected function executeWithMiddleware(
255255
$contentType = $request->getHeaderLine('Content-Type');
256256
if (str_contains($contentType, 'application/json')) {
257257
$decoded = json_decode($bodyContents, true);
258-
if ($decoded !== null) {
258+
if (json_last_error() === JSON_ERROR_NONE) {
259259
$options['json'] = $decoded;
260260
unset($options['body']);
261261
} else {

src/Fetch/Interfaces/MiddlewareInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface MiddlewareInterface
2020
*
2121
* @param RequestInterface $request The HTTP request to process
2222
* @param callable $next The next middleware or final handler
23-
* @return Response|PromiseInterface<Response> The response or promise
23+
* @return \Fetch\Interfaces\Response|PromiseInterface<\Fetch\Interfaces\Response> The response or promise
2424
*/
2525
public function handle(RequestInterface $request, callable $next): Response|PromiseInterface;
2626
}

0 commit comments

Comments
 (0)