This commit is contained in:
2023-09-15 16:05:48 +08:00
parent 3d6099ea6e
commit ceadca4d83
+5 -3
View File
@@ -99,11 +99,13 @@ class Handler implements RequestHandlerInterface
return $result;
}
if (is_object($result)) {
$result = '[object]';
} else if (is_array($result)) {
$result = json_encode($result, JSON_UNESCAPED_UNICODE);
return \response()->withBody(new Stream('[object]'));
}
if (is_array($result)) {
return \response()->withContentType(ContentType::JSON)->withBody(new Stream(json_encode($result, JSON_UNESCAPED_UNICODE)));
} else {
return \response()->withBody(new Stream($result));
}
}
}