0
// curl -v -S -u root:abc123456 -F'notification={"applicationId":"229396","schemaId":"229506","topicId":"98315","type":"USER"};type=application/json' "http://wy.com/" | python -mjson.tool
CloseableHttpClient client = HttpClients.createDefault();
HttpPost post = new HttpPost(url);
MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
StringBody comment = new StringBody(param,ContentType.APPLICATION_JSON);
reqEntity.addPart("notification", comment);
post.setEntity(reqEntity);
post.addHeader("Authorization", getHeader(authString));
上面是我的curl和Java代碼。如何使用java來模擬CURL傳輸參數?
我已經設置了通知類型,但在運行的時候,仍然有錯誤的400提示:
400
Required request part 'notification' is not present
是否有任何人誰可以幫我看看問題出在哪裏?