mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: POST /api/signal return 406 if any connectionId wrong
parent
eb57d02188
commit
19d30558d8
|
@ -356,16 +356,16 @@ public class SessionEventsHandler {
|
||||||
} else {
|
} else {
|
||||||
Set<String> participantPublicIds = participants.stream().map(Participant::getParticipantPublicId)
|
Set<String> participantPublicIds = participants.stream().map(Participant::getParticipantPublicId)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
for (String to : toSet) {
|
if (participantPublicIds.containsAll(toSet)) {
|
||||||
if (participantPublicIds.contains(to)) {
|
for (String to : toSet) {
|
||||||
Optional<Participant> p = participants.stream().filter(x -> to.equals(x.getParticipantPublicId()))
|
Optional<Participant> p = participants.stream().filter(x -> to.equals(x.getParticipantPublicId()))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
rpcNotificationService.sendNotification(p.get().getParticipantPrivateId(),
|
rpcNotificationService.sendNotification(p.get().getParticipantPrivateId(),
|
||||||
ProtocolElements.PARTICIPANTSENDMESSAGE_METHOD, params);
|
ProtocolElements.PARTICIPANTSENDMESSAGE_METHOD, params);
|
||||||
} else {
|
|
||||||
throw new OpenViduException(Code.SIGNAL_TO_INVALID_ERROR_CODE,
|
|
||||||
"Signal \"to\" field invalid format: Connection [" + to + "] does not exist");
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
throw new OpenViduException(Code.SIGNAL_TO_INVALID_ERROR_CODE,
|
||||||
|
"Signal \"to\" field invalid format: some connectionId does not exist in this session");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2579,6 +2579,8 @@ public class OpenViduTestAppE2eTest {
|
||||||
/** POST /api/signal (ACTIVE SESSION) **/
|
/** POST /api/signal (ACTIVE SESSION) **/
|
||||||
body = "{'session':'CUSTOM_SESSION_ID','to':['wrongConnectionId']}";
|
body = "{'session':'CUSTOM_SESSION_ID','to':['wrongConnectionId']}";
|
||||||
restClient.rest(HttpMethod.POST, "/api/signal", body, HttpStatus.SC_NOT_ACCEPTABLE); // No valid connectionId
|
restClient.rest(HttpMethod.POST, "/api/signal", body, HttpStatus.SC_NOT_ACCEPTABLE); // No valid connectionId
|
||||||
|
body = "{'session':'CUSTOM_SESSION_ID','to':['" + connectionId + "','wrongConnectionId']}";
|
||||||
|
restClient.rest(HttpMethod.POST, "/api/signal", body, HttpStatus.SC_NOT_ACCEPTABLE); // No valid connectionId
|
||||||
body = "{'session':'CUSTOM_SESSION_ID'}";
|
body = "{'session':'CUSTOM_SESSION_ID'}";
|
||||||
restClient.rest(HttpMethod.POST, "/api/signal", body, HttpStatus.SC_OK);
|
restClient.rest(HttpMethod.POST, "/api/signal", body, HttpStatus.SC_OK);
|
||||||
user.getEventManager().waitUntilEventReaches("signal", 2);
|
user.getEventManager().waitUntilEventReaches("signal", 2);
|
||||||
|
|
Loading…
Reference in New Issue