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

Fixed http response status check in gms-client lib

parent 947c53e1
......@@ -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();
......
......@@ -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();
......
......@@ -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);
......
......@@ -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);
......
......@@ -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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment