class PostmanService {

    void deleteTempFile(Response response) {
        if (response != null && response.getStream() != null) {
            Stream stream = response.getStream();
            final File tempFile = stream.getTempFile();
            if (tempFile != null) {
                try {
                    Files.delete(Paths.get(tempFile.getPath()));
                } catch (IOException e) {
                    log.error("Cannot delete temporary file {}", tempFile, e);
                }
                stream.setTempFile(null);
            }
        }
    }

}