Merge branch 'develop' into stable
This commit is contained in:
commit
ce92fc5b22
@ -19,8 +19,8 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.inteligr8.http.BaseResponse;
|
||||
import com.inteligr8.http.PreemptiveAuthInterceptor;
|
||||
import com.inteligr8.github.http.BaseResponse;
|
||||
import com.inteligr8.github.http.PreemptiveAuthInterceptor;
|
||||
|
||||
public class ApiGateway {
|
||||
|
||||
@ -84,15 +84,21 @@ public class ApiGateway {
|
||||
if (this.logger.isDebugEnabled())
|
||||
this.logger.debug("Received response from " + method + ": " + response.getStatusLine().getStatusCode());
|
||||
|
||||
Response responseObject = null;
|
||||
if (response.getEntity() != null) {
|
||||
InputStream istream = response.getEntity().getContent();
|
||||
try {
|
||||
Response responseObject = this.omapper.readerFor(responseType).readValue(istream);
|
||||
responseObject.setHttpStatusCode(response.getStatusLine().getStatusCode());
|
||||
responseObject.setHttpStatusReason(response.getStatusLine().getReasonPhrase());
|
||||
return responseObject;
|
||||
responseObject = this.omapper.readerFor(responseType).readValue(istream);
|
||||
} finally {
|
||||
istream.close();
|
||||
}
|
||||
} else {
|
||||
responseObject = this.omapper.readerFor(responseType).readValue("{}");
|
||||
}
|
||||
|
||||
responseObject.setHttpStatusCode(response.getStatusLine().getStatusCode());
|
||||
responseObject.setHttpStatusReason(response.getStatusLine().getReasonPhrase());
|
||||
return responseObject;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.inteligr8.http;
|
||||
package com.inteligr8.github.http;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.inteligr8.http;
|
||||
package com.inteligr8.github.http;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -2,7 +2,7 @@ package com.inteligr8.github.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.inteligr8.http.BaseResponse;
|
||||
import com.inteligr8.github.http.BaseResponse;
|
||||
|
||||
public class CreatePullRequest {
|
||||
|
||||
|
@ -2,7 +2,7 @@ package com.inteligr8.github.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.inteligr8.http.BaseResponse;
|
||||
import com.inteligr8.github.http.BaseResponse;
|
||||
|
||||
public class CreateReference {
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.inteligr8.github.model;
|
||||
|
||||
public class DeleteReference {
|
||||
|
||||
private DeleteReference() {
|
||||
}
|
||||
|
||||
public static String constructRequestPath(String repoName, String ref) {
|
||||
return "/repos/" + repoName + "/" + httpPath + "/" + ref;
|
||||
}
|
||||
|
||||
public static String constructRequestPathByBranch(String repoName, String branchName) {
|
||||
return constructRequestPath(repoName, "refs/heads/" + branchName);
|
||||
}
|
||||
|
||||
public static String httpPath = "git";
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user