Fixing issue regarding GET and DELETE method (#76)

This commit is contained in:
mestizoLopez 2020-01-09 14:52:20 -06:00 committed by Artur Souza
parent 858f28a34b
commit eb7d1b62cf
1 changed files with 7 additions and 1 deletions

View File

@ -125,8 +125,14 @@ class DaprHttp {
Request.Builder requestBuilder = new Request.Builder() Request.Builder requestBuilder = new Request.Builder()
.url(new URL(this.baseUrl + urlString)) .url(new URL(this.baseUrl + urlString))
.method(method, body)
.addHeader(Constants.HEADER_DAPR_REQUEST_ID, requestId); .addHeader(Constants.HEADER_DAPR_REQUEST_ID, requestId);
if (Constants.defaultHttpMethodSupported.GET.name().equals(method)) {
requestBuilder.get();
} else if (Constants.defaultHttpMethodSupported.DELETE.name().equals(method)) {
requestBuilder.delete();
} else {
requestBuilder.method(method, body);
}
if (headers != null) { if (headers != null) {
Optional.ofNullable(headers.entrySet()).orElse(Collections.emptySet()).stream() Optional.ofNullable(headers.entrySet()).orElse(Collections.emptySet()).stream()
.forEach(header -> { .forEach(header -> {