Skip to content

Commit 9ab8dcf

Browse files
authored
Update BaseClient.php
1 parent de95abc commit 9ab8dcf

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/BaseClient.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected function makeClient(?\Swlib\Http\Uri $uri = null): self {
9898
$client = \Swlib\SaberGM::psr([
9999
'use_pool' => static::USE_POOL,
100100
'method' => static::METHOD,
101-
'useragent' => 'MangoHttpClient/3.0.0 (CentOS 7; Cor)',
101+
'useragent' => 'Swango/1.2',
102102
'timeout' => static::TIMEOUT,
103103
'keep_alive' => static::KEEP_ALIVE,
104104
'uri' => $uri,
@@ -216,7 +216,8 @@ protected function parseRequest(&$post, &$get, &$header, ?string $request_string
216216
$swoole_request = \Swango\HttpServer\Controller::getInstance()->getSwooleHttpRequest();
217217
if (\Swango\HttpServer\Router::getInstance()->getMethod() === 'POST') {
218218
if (static::PARSE_POST === self::PARSE_MODE_URL_ENCODE_KV) {
219-
$post = $swoole_request->post;
219+
$post = null;
220+
parse_str($swoole_request->rawContent(), $post);
220221
} elseif (static::PARSE_POST === self::PARSE_MODE_JSON) {
221222
$post = \Json::decodeAsArray($swoole_request->rawContent());
222223
} else {
@@ -240,7 +241,7 @@ protected function parseRequest(&$post, &$get, &$header, ?string $request_string
240241
}
241242
unset($value);
242243
$log_string = date('[Y-m-d H:i:s] ', \Time\now()) . "----------Webhook----------\n";
243-
$log_string .= $swoole_request->getData() . "\n";
244+
$log_string .= $swoole_request->getData() . "\n\n";
244245
$this->writeLog($log_string);
245246
} else {
246247
if (! isset($request_string)) {
@@ -312,4 +313,4 @@ public static function parseRequestString(string $string): Swlib\Http\Request {
312313
}
313314
return $request;
314315
}
315-
}
316+
}

0 commit comments

Comments
 (0)