I try to pass parameters in post request in integration test, but I get response that required parameter "source" aint detected. Maybe you will know what is cause. Thank you.
public void testUploadBundleFromRepository() throws IOException, InterruptedException {
String boundary = "---------------"+ UUID.randomUUID().toString();
String uri = String.format("http://%s:%d/upload/", HOST, PORT);
HttpPost httpPost = new HttpPost(uri);
httpPost.setHeader(HTTP.CONTENT_TYPE, ContentType.MULTIPART_FORM_DATA.getMimeType()+";boundary="+boundary);
List<NameValuePair> postParameters = new ArrayList<>();
postParameters.add(new BasicNameValuePair("source","repo"));
postParameters.add(new BasicNameValuePair("id","1"));
postParameters.add(new BasicNameValuePair("start", "true"));
httpPost.setEntity(new UrlEncodedFormEntity(postParameters, "UTF-8"));
HttpResponse response = getHttpClient().execute(httpPost);
//assert in future
}
Aucun commentaire:
Enregistrer un commentaire