Skip to content

Commit

Permalink
Merge pull request #17 from jpush/dev
Browse files Browse the repository at this point in the history
http2 add sendDelete(String, String)
  • Loading branch information
KenChoi1992 authored Nov 30, 2017
2 parents fdacd71 + 7b692b5 commit 63c14f9
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/main/java/cn/jiguang/common/connection/Http2Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,30 @@ public ResponseWrapper sendDelete(String url) throws APIConnectionException, API
return wrapper;
}

@Override
public ResponseWrapper sendDelete(String url, String content) throws APIConnectionException, APIRequestException {
ResponseWrapper wrapper = new ResponseWrapper();
LOG.debug("Send request - Delete url:" + " " + url + " content: " + content);
Request request;
try {
RequestBody body = RequestBody.create(JSON, content);
request = new Request.Builder().url(url)
.header("User-Agent", JPUSH_USER_AGENT)
.addHeader("Accept-Charset", CHARSET)
.addHeader("Charset", CHARSET)
.addHeader("Connection", "Keep-Alive")
.addHeader("Authorization", _authCode)
.addHeader("Content-Type", CONTENT_TYPE_JSON)
.delete(body).build();
handleResponse(wrapper, request);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return wrapper;
}

@Override
public ResponseWrapper sendPost(String url, String content) throws APIConnectionException, APIRequestException {
LOG.debug("Send request - Post url:" + " " + url + " content: " + content);
Expand Down

0 comments on commit 63c14f9

Please sign in to comment.