Commit c89c1fd4585034a5ef1f217830046be7868e65ae

Authored by Andrew Shvayka
Committed by GitHub
2 parents 8be682d1 4a61616b

Merge pull request #1227 from ShvaykaD/master

Modify TbRestApiCallNode
... ... @@ -118,16 +118,16 @@ public class TbRestApiCallNode implements TbNode {
118 118 }
119 119
120 120 private TbMsg processResponse(TbContext ctx, TbMsg origMsg, ResponseEntity<String> response) {
121   - TbMsgMetaData metaData = new TbMsgMetaData();
  121 + TbMsgMetaData metaData = origMsg.getMetaData();
122 122 metaData.putValue(STATUS, response.getStatusCode().name());
123 123 metaData.putValue(STATUS_CODE, response.getStatusCode().value()+"");
124 124 metaData.putValue(STATUS_REASON, response.getStatusCode().getReasonPhrase());
125   - response.getHeaders().toSingleValueMap().forEach((k,v) -> metaData.putValue(k,v) );
  125 + response.getHeaders().toSingleValueMap().forEach(metaData::putValue);
126 126 return ctx.transformMsg(origMsg, origMsg.getType(), origMsg.getOriginator(), metaData, response.getBody());
127 127 }
128 128
129 129 private TbMsg processFailureResponse(TbContext ctx, TbMsg origMsg, ResponseEntity<String> response) {
130   - TbMsgMetaData metaData = origMsg.getMetaData().copy();
  130 + TbMsgMetaData metaData = origMsg.getMetaData();
131 131 metaData.putValue(STATUS, response.getStatusCode().name());
132 132 metaData.putValue(STATUS_CODE, response.getStatusCode().value()+"");
133 133 metaData.putValue(STATUS_REASON, response.getStatusCode().getReasonPhrase());
... ... @@ -136,7 +136,7 @@ public class TbRestApiCallNode implements TbNode {
136 136 }
137 137
138 138 private TbMsg processException(TbContext ctx, TbMsg origMsg, Throwable e) {
139   - TbMsgMetaData metaData = origMsg.getMetaData().copy();
  139 + TbMsgMetaData metaData = origMsg.getMetaData();
140 140 metaData.putValue(ERROR, e.getClass() + ": " + e.getMessage());
141 141 if (e instanceof HttpClientErrorException) {
142 142 HttpClientErrorException httpClientErrorException = (HttpClientErrorException)e;
... ...