使用 JWT 令牌发布请求 HttpClient(发现错误请求错误 /chunked:false)
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(RestUrl.SAVE_INVENTORY);
Gson gson = new Gson();
String json = gson.toJson(inventoryDto);
StringEntity entity = new StringEntity(json);
httpPost.setEntity(entity);
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-type", "application/json");
httpPost.addHeader("Authorization", "JWT " +LoginDaoIMPL.token);
CloseableHttpResponse response = client.execute(httpPost);
client.close();