Skip to content

Commit

Permalink
fixes #74 add content type header as body parser needs it.
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehu committed Aug 25, 2017
1 parent 3f4cf19 commit 16a2239
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import java.util.concurrent.atomic.AtomicReference;
final AtomicReference<ClientResponse> reference = new AtomicReference<>();
try {
ClientRequest request = new ClientRequest().setPath("/api/json").setMethod(Methods.POST);
request.getRequestHeaders().put(Headers.CONTENT_TYPE, "application/json");
request.getRequestHeaders().put(Headers.TRANSFER_ENCODING, "chunked");
connection.sendRequest(request, client.createClientCallback(reference, latch, "request body to be replaced"));
latch.await();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class @className {
try {
ClientRequest request = new ClientRequest().setPath("@path").setMethod(Methods.@httpMethod);
@if(hasBody) {
request.getRequestHeaders().put(Headers.CONTENT_TYPE, "application/json");
request.getRequestHeaders().put(Headers.TRANSFER_ENCODING, "chunked");
connection.sendRequest(request, client.createClientCallback(reference, latch, "request body to be replaced"));
} else {
Expand Down

0 comments on commit 16a2239

Please sign in to comment.