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
c8ccbaa7
Commit
c8ccbaa7
authored
Jun 26, 2018
by
Greg Messner
Browse files
validate() now properly handles expected HTTP status in the 200-204 range (#203).
parent
68345120
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/AbstractApi.java
View file @
c8ccbaa7
...
@@ -429,8 +429,15 @@ public abstract class AbstractApi implements Constants {
...
@@ -429,8 +429,15 @@ public abstract class AbstractApi implements Constants {
*/
*/
protected
Response
validate
(
Response
response
,
Response
.
Status
expected
)
throws
GitLabApiException
{
protected
Response
validate
(
Response
response
,
Response
.
Status
expected
)
throws
GitLabApiException
{
if
(
response
.
getStatus
()
!=
expected
.
getStatusCode
())
{
int
responseCode
=
response
.
getStatus
();
throw
new
GitLabApiException
(
response
);
int
expectedResponseCode
=
expected
.
getStatusCode
();
if
(
responseCode
!=
expectedResponseCode
)
{
// If the expected code is 200-204 and the response code is 200-204 it is OK. We do this because
// GitLab is constantly changing the expected code in the 200 to 204 range
if
(
expectedResponseCode
>
204
||
responseCode
>
204
||
expectedResponseCode
<
200
||
responseCode
<
200
)
throw
new
GitLabApiException
(
response
);
}
}
if
(!
getApiClient
().
validateSecretToken
(
response
))
{
if
(!
getApiClient
().
validateSecretToken
(
response
))
{
...
...
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