Commit a989ae7c authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Fixed http response status check in gms-client lib

parent 947c53e1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ public class AddMemberCall extends BaseGmsCall {

        HttpRequest groupsRequest = newHttpRequest(endpoint)
                .header("Accept", "text/plain")
                .header("Content-Type", "application/x-www-form-urlencoded")
                .POST(BodyPublishers.ofString("user_id=" + userId))
                .build();

+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ public class AddPermissionCall extends BaseGmsCall {

        HttpRequest groupsRequest = newHttpRequest(endpoint)
                .header("Accept", "text/plain")
                .header("Content-Type", "application/x-www-form-urlencoded")
                .POST(requestBody)
                .build();

+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ public class CreateGroupCall extends BaseGmsCall {

        return getClient().sendAsync(groupsRequest, HttpResponse.BodyHandlers.ofInputStream())
                .thenApply(response -> {
                    if (response.statusCode() == 200) {
                    if (response.statusCode() == 201) {
                        return true;
                    }
                    logServerErrorInputStream(groupsRequest, response);
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ public class GmsClientTest {
    @Test
    public void testCreateGroup() {

        CompletableFuture response = CompletableFuture.completedFuture(getMockedResponse(200));
        CompletableFuture response = CompletableFuture.completedFuture(getMockedResponse(201));

        when(httpClient.sendAsync(any(), any())).thenReturn(response);
        client.createGroup("LBT.INAF", false);
+1 −1
Original line number Diff line number Diff line
@@ -278,7 +278,7 @@ public class JWTWebServiceController {
        for (int i = 0; i < index + 1; i++) {
            String groupName = groupNames.get(i);
            group = groupsDAO.findGroupByParentAndName(parentPath, groupName)
                    .orElseThrow(() -> new IllegalArgumentException("Unable to find group " + groupName));
                    .orElseThrow(() -> new BadRequestException("Unable to find group " + groupName));
            parentPath = group.getPath();
        }
        if (group == null) {