Fixed JSON content type issue.
This commit is contained in:
parent
a18b3244e9
commit
22bc5f4168
1 changed files with 5 additions and 3 deletions
|
@ -328,7 +328,11 @@ final class SockChatHandler extends Handler {
|
|||
}
|
||||
|
||||
public function verify($response, $request): array {
|
||||
if(!$request->isStreamContent())
|
||||
if($request->isStreamContent())
|
||||
$authInfo = json_decode((string)$request->getContent());
|
||||
elseif($request->isJsonContent())
|
||||
$authInfo = $request->getContent()->getContent(); // maybe change this api lol, this looks silly
|
||||
else
|
||||
return ['success' => false, 'reason' => 'request'];
|
||||
|
||||
$userHash = $request->hasHeader('X-SharpChat-Signature') ? $request->getHeaderFirstLine('X-SharpChat-Signature') : '';
|
||||
|
@ -336,8 +340,6 @@ final class SockChatHandler extends Handler {
|
|||
if(strlen($userHash) !== 64)
|
||||
return ['success' => false, 'reason' => 'length'];
|
||||
|
||||
$authInfo = json_decode((string)$request->getContent());
|
||||
|
||||
if(!isset($authInfo->user_id, $authInfo->token, $authInfo->ip))
|
||||
return ['success' => false, 'reason' => 'data'];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue