Skip to content

Commit

Permalink
Merge 785aa3b into aafc487
Browse files Browse the repository at this point in the history
  • Loading branch information
wangshenggh committed May 30, 2019
2 parents aafc487 + 785aa3b commit f3b33a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ public void setRequestBody(Object requestBody) {
this.requestBody = requestBody;
}

public void setHttpHeaders(HttpHeaders headers) {
if (headers !=null) {
this.httpHeaders = headers;
}
}
@Override
public HttpMethod getMethod() {
return method;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public void doWithRequest(AsyncClientHttpRequest request) {
CseAsyncClientHttpRequest cseAsyncClientHttpRequest = (CseAsyncClientHttpRequest) request;
if (requestBody != null) {
cseAsyncClientHttpRequest.setRequestBody(requestBody.getBody());
cseAsyncClientHttpRequest.setHttpHeaders(requestBody.getHeaders());
}

if (!CseHttpEntity.class.isInstance(requestBody)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
Expand Down Expand Up @@ -84,7 +85,10 @@ protected Response doInvoke(Invocation invocation) {
}
};
byte[] body = "abc".getBytes();
HttpHeaders headers = new HttpHeaders();
headers.add("token", "123");
client.setRequestBody(body);
client.setHttpHeaders(headers);

client.execute();

Expand Down

0 comments on commit f3b33a4

Please sign in to comment.