Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
133623a0
Commit
133623a0
authored
Nov 29, 2017
by
Greg Messner
Browse files
Fixed PUT with no entity (#101).
parent
0e33be2d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/GitLabApiClient.java
View file @
133623a0
...
@@ -403,7 +403,12 @@ public class GitLabApiClient {
...
@@ -403,7 +403,12 @@ public class GitLabApiClient {
* @return a ClientResponse instance with the data returned from the endpoint
* @return a ClientResponse instance with the data returned from the endpoint
*/
*/
protected
Response
put
(
MultivaluedMap
<
String
,
String
>
queryParams
,
URL
url
)
{
protected
Response
put
(
MultivaluedMap
<
String
,
String
>
queryParams
,
URL
url
)
{
return
(
invocation
(
url
,
null
).
put
(
Entity
.
entity
(
queryParams
,
MediaType
.
APPLICATION_FORM_URLENCODED_TYPE
)));
if
(
queryParams
==
null
||
queryParams
.
isEmpty
())
{
Entity
<?>
empty
=
Entity
.
text
(
""
);
return
(
invocation
(
url
,
null
).
put
(
empty
));
}
else
{
return
(
invocation
(
url
,
null
).
put
(
Entity
.
entity
(
queryParams
,
MediaType
.
APPLICATION_FORM_URLENCODED_TYPE
)));
}
}
}
/**
/**
...
...
src/main/java/org/gitlab4j/api/RepositoryApi.java
View file @
133623a0
...
@@ -112,8 +112,7 @@ public class RepositoryApi extends AbstractApi {
...
@@ -112,8 +112,7 @@ public class RepositoryApi extends AbstractApi {
/**
/**
* Delete a single project repository branch. This is an idempotent function,
* Delete a single project repository branch.
* protecting an already protected repository branch will not produce an error.
*
*
* DELETE /projects/:id/repository/branches/:branch
* DELETE /projects/:id/repository/branches/:branch
*
*
...
@@ -138,7 +137,7 @@ public class RepositoryApi extends AbstractApi {
...
@@ -138,7 +137,7 @@ public class RepositoryApi extends AbstractApi {
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Branch
protectBranch
(
Integer
projectId
,
String
branchName
)
throws
GitLabApiException
{
public
Branch
protectBranch
(
Integer
projectId
,
String
branchName
)
throws
GitLabApiException
{
Response
response
=
put
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"repository"
,
"branches"
,
branchName
,
"protect"
);
Response
response
=
put
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"repository"
,
"branches"
,
urlEncode
(
branchName
)
,
"protect"
);
return
(
response
.
readEntity
(
Branch
.
class
));
return
(
response
.
readEntity
(
Branch
.
class
));
}
}
...
@@ -154,7 +153,7 @@ public class RepositoryApi extends AbstractApi {
...
@@ -154,7 +153,7 @@ public class RepositoryApi extends AbstractApi {
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
Branch
unprotectBranch
(
Integer
projectId
,
String
branchName
)
throws
GitLabApiException
{
public
Branch
unprotectBranch
(
Integer
projectId
,
String
branchName
)
throws
GitLabApiException
{
Response
response
=
put
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"repository"
,
"branches"
,
branchName
,
"unprotect"
);
Response
response
=
put
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"repository"
,
"branches"
,
urlEncode
(
branchName
)
,
"unprotect"
);
return
(
response
.
readEntity
(
Branch
.
class
));
return
(
response
.
readEntity
(
Branch
.
class
));
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment