Within a SpringBoot app, I am attempting to return images via a Response object's outputBuffer, via:
try {
response.setContentType("image/png");
InputStream in = new FileInputStream(pathToFile);
IOUtils.copy(in, response.getOutputStream());
}
catch (Exception e){
...
}
This works fine, unless the image is less than 8kb, in which case it just returns nothing.
Can anyone tell me why being less than 8kb would cause the Response to actually return zero data (and - crucially - how to remedy this)?