I want to verify what exactly is in HTTP request i.e Parameters and Headers. The code, which I am debugging uses MultiPartEntity to setEntity before making executing HTTP Request.
response = executePost(multipartEntity);
statusCode = response.statusCode;
I am not getting the expected response from the server hence want to verify what is the exact thing (url + parameters) that is being send to the server.
Thanks.
Something like the following will do the trick:
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
multipartEntity.writeTo(bytes);
String content = bytes.toString();
As suhas_sm mentioned the getContent() method exists but is not implemented.
I have achieved by this
MultipartEntity reqEntityB = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
java.io.ByteArrayOutputStream out = new java.io.ByteArrayOutputStream(
(int) reqEntityB.getContentLength());
reqEntityB.writeTo(out);
String entityContentAsString = new String(out.toByteArray());
Log.e("multipartEntitty:", "" + entityContentAsString);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With