|
33 | 33 | import javax.net.ssl.SSLException; |
34 | 34 | import javax.net.ssl.SSLHandshakeException; |
35 | 35 | import java.io.*; |
| 36 | +import java.net.URI; |
36 | 37 | import java.net.UnknownHostException; |
37 | 38 | import java.text.SimpleDateFormat; |
38 | 39 | import java.util.Date; |
@@ -283,11 +284,13 @@ public ResponseWrapper sendDelete(String url, String content) |
283 | 284 | throws APIConnectionException, APIRequestException { |
284 | 285 | ResponseWrapper wrapper = new ResponseWrapper(); |
285 | 286 | CloseableHttpResponse response = null; |
286 | | - HttpDelete httpDelete = new HttpDelete(url); |
| 287 | + HttpDeleteWithBody httpDelete = new HttpDeleteWithBody(url); |
287 | 288 | try { |
288 | 289 | httpDelete.setHeader(HttpHeaders.AUTHORIZATION, _authCode); |
289 | 290 | httpDelete.setHeader("Content-Type", "application/json"); |
290 | 291 | configHttpRequest(httpDelete); |
| 292 | + StringEntity params = new StringEntity(StringUtils.notNull(content), CHARSET); |
| 293 | + httpDelete.setEntity(params); |
291 | 294 | response = getHttpClient(url).execute(httpDelete, HttpClientContext.create()); |
292 | 295 | processResponse(response, wrapper); |
293 | 296 | } catch (IOException e) { |
@@ -495,3 +498,17 @@ public void close() { |
495 | 498 | } |
496 | 499 | } |
497 | 500 | } |
| 501 | + |
| 502 | + |
| 503 | +class HttpDeleteWithBody extends HttpEntityEnclosingRequestBase { |
| 504 | + public static final String METHOD_NAME = "DELETE"; |
| 505 | + |
| 506 | + public String getMethod() { |
| 507 | + return METHOD_NAME; |
| 508 | + } |
| 509 | + |
| 510 | + public HttpDeleteWithBody(final String uri) { |
| 511 | + super(); |
| 512 | + setURI(URI.create(uri)); |
| 513 | + } |
| 514 | +} |
0 commit comments