Skip to content

Commit 9ff4dda

Browse files
committed
return 201 when configuration was set
fixes #4318
1 parent 5b998bd commit 9ff4dda

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

opengrok-web/src/main/java/org/opengrok/web/api/v1/controller/ConfigurationController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2017, 2020, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.web.api.v1.controller;
@@ -81,7 +81,7 @@ public Response set(@Context HttpServletRequest request,
8181
env.applyConfig(body, reindex, CommandTimeoutType.RESTFUL);
8282
suggesterService.refresh();
8383
return null;
84-
}));
84+
}, Response.Status.CREATED));
8585
}
8686

8787
@GET
@@ -104,7 +104,7 @@ public Response setField(@Context HttpServletRequest request,
104104
env.applyConfig(false, CommandTimeoutType.RESTFUL);
105105
suggesterService.refresh();
106106
return null;
107-
}));
107+
}, Response.Status.NO_CONTENT));
108108
}
109109

110110
@POST

opengrok-web/src/test/java/org/opengrok/web/api/v1/controller/ConfigurationControllerTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2020, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.web.api.v1.controller;
@@ -97,7 +97,8 @@ void testApplySetAndGetBasicConfig() throws Exception {
9797
Response response = target("configuration")
9898
.request()
9999
.put(Entity.xml(configStr));
100-
ApiUtils.waitForAsyncApi(response);
100+
Response finalResponse = ApiUtils.waitForAsyncApi(response);
101+
assertEquals(Response.Status.CREATED.getStatusCode(), finalResponse.getStatus());
101102

102103
assertEquals(srcRoot, env.getSourceRootPath());
103104

0 commit comments

Comments
 (0)