mirror of
https://github.com/elyby/accounts.git
synced 2024-11-27 01:02:06 +05:30
Fix sessionserver/join endpoint: return empty response with 204 status code on success join
This commit is contained in:
parent
984c6e7682
commit
47463d7435
@ -34,19 +34,18 @@ class SessionController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return array
|
|
||||||
* @throws ForbiddenOperationException
|
* @throws ForbiddenOperationException
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException
|
||||||
*/
|
*/
|
||||||
public function actionJoin(): array {
|
public function actionJoin(Response $response): void {
|
||||||
Yii::$app->response->format = Response::FORMAT_JSON;
|
|
||||||
|
|
||||||
$data = Yii::$app->request->post();
|
$data = Yii::$app->request->post();
|
||||||
$protocol = new ModernJoin($data['accessToken'] ?? '', $data['selectedProfile'] ?? '', $data['serverId'] ?? '');
|
$protocol = new ModernJoin($data['accessToken'] ?? '', $data['selectedProfile'] ?? '', $data['serverId'] ?? '');
|
||||||
$joinForm = new JoinForm($protocol);
|
$joinForm = new JoinForm($protocol);
|
||||||
$joinForm->join(); // will throw an exception in case of any error
|
$joinForm->join(); // will throw an exception in case of any error
|
||||||
|
|
||||||
return ['id' => 'OK'];
|
$response->statusCode = 204;
|
||||||
|
$response->format = Response::FORMAT_RAW;
|
||||||
|
$response->content = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function actionJoinLegacy(): string {
|
public function actionJoinLegacy(): string {
|
||||||
|
@ -30,7 +30,7 @@ class SessionServerSteps extends FunctionalTester {
|
|||||||
'serverId' => $serverId,
|
'serverId' => $serverId,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->canSeeResponseContainsJson(['id' => 'OK']);
|
$this->seeResponseCodeIs(204);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [$username, $serverId];
|
return [$username, $serverId];
|
||||||
|
@ -150,12 +150,9 @@ class JoinCest {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function expectSuccessResponse(FunctionalTester $I) {
|
private function expectSuccessResponse(FunctionalTester $I): void {
|
||||||
$I->seeResponseCodeIs(200);
|
$I->seeResponseCodeIs(204);
|
||||||
$I->seeResponseIsJson();
|
$I->canSeeResponseEquals('');
|
||||||
$I->canSeeResponseContainsJson([
|
|
||||||
'id' => 'OK',
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user