This commit is contained in:
2021-03-23 18:27:45 +08:00
parent d998cd21e2
commit fbc96b3e60
+4 -5
View File
@@ -95,18 +95,17 @@ class Service extends Component
public static function replace(Request $request, array $service): Request public static function replace(Request $request, array $service): Request
{ {
if (!is_array($body = $request->params->getBodyAndClear())) { if (!is_array($body = $request->params->getBodyAndClear())) {
var_dump($body);
throw new Exception('Protocol format error.'); throw new Exception('Protocol format error.');
} }
if (!isset($serialize['cmd'])) { if (!isset($body['cmd'])) {
throw new Exception('Protocol format error.'); throw new Exception('Protocol format error.');
} }
$request->params->setPosts($serialize); $request->params->setPosts($body);
$serialize['cmd'] = ltrim($serialize['cmd'], '/'); $body['cmd'] = ltrim($body['cmd'], '/');
$header = $request->headers; $header = $request->headers;
$header->replace('request_uri', 'rpc/p' . $service['port'] . '/' . $serialize['cmd']); $header->replace('request_uri', 'rpc/p' . $service['port'] . '/' . $body['cmd']);
$header->replace('request_method', Request::HTTP_CMD); $header->replace('request_method', Request::HTTP_CMD);
return $request; return $request;