[Android][Volley] fix support for post null body

This commit is contained in:
Mateusz Mackowiak 2016-06-13 17:23:34 +02:00
parent cfa40b1484
commit 0816f315d3

View File

@ -34,11 +34,17 @@ public class PostRequest extends Request<String> {
@Override @Override
public String getBodyContentType() { public String getBodyContentType() {
if(entity == null ) {
return null;
}
return entity.getContentType().getValue(); return entity.getContentType().getValue();
} }
@Override @Override
public byte[] getBody() throws AuthFailureError { public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream(); ByteArrayOutputStream bos = new ByteArrayOutputStream();
try { try {
entity.writeTo(bos); entity.writeTo(bos);