Skip to content

Commit 846cfaf

Browse files
otaryjmini
andauthored
Use GitLabApiForm in post requests (#1224)
--------- Co-authored-by: Jérémie Bresson <[email protected]>
1 parent d1e1f05 commit 846cfaf

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

gitlab4j-api/src/main/java/org/gitlab4j/api/GroupApi.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ public Optional<Group> getOptionalGroup(Object groupIdOrPath) {
636636
* @throws GitLabApiException if any exception occurs
637637
*/
638638
public Group createGroup(GroupParams params) throws GitLabApiException {
639-
Response response = post(Response.Status.CREATED, params.getForm(true), "groups");
639+
Response response = post(Response.Status.CREATED, new GitLabApiForm(params.getForm(true)), "groups");
640640
return (response.readEntity(Group.class));
641641
}
642642

@@ -651,8 +651,11 @@ public Group createGroup(GroupParams params) throws GitLabApiException {
651651
* @throws GitLabApiException at any exception
652652
*/
653653
public Group updateGroup(Object groupIdOrPath, GroupParams params) throws GitLabApiException {
654-
Response response =
655-
putWithFormData(Response.Status.OK, params.getForm(false), "groups", getGroupIdOrPath(groupIdOrPath));
654+
Response response = putWithFormData(
655+
Response.Status.OK,
656+
new GitLabApiForm(params.getForm(false)),
657+
"groups",
658+
getGroupIdOrPath(groupIdOrPath));
656659
return (response.readEntity(Group.class));
657660
}
658661

@@ -2455,7 +2458,11 @@ public void revokeGroupAccessToken(Object groupIdOrPath, Long tokenId) throws Gi
24552458
*/
24562459
public GroupHook addWebhook(Object groupIdOrPath, GroupHookParams groupHookParams) throws GitLabApiException {
24572460
Response response = post(
2458-
Response.Status.CREATED, groupHookParams.getForm(), "groups", getGroupIdOrPath(groupIdOrPath), "hooks");
2461+
Response.Status.CREATED,
2462+
new GitLabApiForm(groupHookParams.getForm()),
2463+
"groups",
2464+
getGroupIdOrPath(groupIdOrPath),
2465+
"hooks");
24592466
return (response.readEntity(GroupHook.class));
24602467
}
24612468

gitlab4j-api/src/main/java/org/gitlab4j/api/RepositoryApi.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ public void generateChangelog(Object projectIdOrPath, String version) throws Git
11671167
public void generateChangelog(Object projectIdOrPath, ChangelogPayload payload) throws GitLabApiException {
11681168
post(
11691169
Response.Status.OK,
1170-
payload.getFormData(),
1170+
new GitLabApiForm(payload.getFormData()),
11711171
"projects",
11721172
getProjectIdOrPath(projectIdOrPath),
11731173
"repository",

gitlab4j-api/src/main/java/org/gitlab4j/api/TopicsApi.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public Optional<Topic> getOptionalTopic(Integer id) {
113113
* @throws GitLabApiException if any exception occurs
114114
*/
115115
public Topic createTopic(TopicParams params) throws GitLabApiException {
116-
Response response = post(Response.Status.CREATED, params.getForm(true), "topics");
116+
Response response = post(Response.Status.CREATED, new GitLabApiForm(params.getForm(true)), "topics");
117117
return (response.readEntity(Topic.class));
118118
}
119119

0 commit comments

Comments
 (0)