Skip to content

Commit 61b24aa

Browse files
🪴 plugins support
1 parent ca932ab commit 61b24aa

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/main/java/com/contentstack/sdk/CSHttpConnection.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,22 @@ private void getService(String requestUrl) throws IOException {
190190
this.headers.put(USER_AGENT_KEY, USER_AGENT);
191191
this.headers.put(CONTENT_TYPE, APPLICATION_JSON);
192192

193-
Request request = pluginRequestImp(requestUrl);
193+
Request request = null;
194+
if (this.config.plugins!=null){
195+
request = pluginRequestImp(requestUrl);
196+
//this.headers = request.headers();
197+
//requestUrl = request.url();
198+
}
194199

195200
//Call call = client.newCall(request);
196201
Response<ResponseBody> response = this.service.getRequest(requestUrl, this.headers).execute();
197202
if (response.isSuccessful()) {
198203
assert response.body() != null;
204+
199205
// TODO: On Response result
200-
response = pluginResponseImp(request, response);
206+
if (request!=null){
207+
response = pluginResponseImp( request, response);
208+
}
201209
responseJSON = new JSONObject(response.body().string());
202210
if (this.config.livePreviewEntry != null && !this.config.livePreviewEntry.isEmpty()) {
203211
handleJSONArray();

src/main/java/com/contentstack/sdk/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class Config {
3030
protected Proxy proxy = null;
3131
protected ConnectionPool connectionPool = new ConnectionPool();
3232

33-
protected ArrayList<ContentstackPlugin> plugins;
33+
protected ArrayList<ContentstackPlugin> plugins = null;
3434

3535
public String getBranch() {
3636
return branch;

0 commit comments

Comments
 (0)