add ProgressRequestTest

This commit is contained in:
Timi
2025-10-13 10:53:00 +08:00
parent 016c0b7e2f
commit e63d1103d8
2 changed files with 44 additions and 0 deletions

View File

@ -42,10 +42,12 @@ public class ProgressiveRequest extends FileRequest {
return new ProgressiveRequest(Request.post(url), callback);
}
@Override
public void toFile(Path outputPath) throws IOException, NoPermissionException {
processResponse(request.execute(), IO.getOutputStream(outputPath.toFile()));
}
@Override
public void toFile(File file) throws IOException, NoPermissionException {
processResponse(request.execute(), IO.getOutputStream(file));
}
@ -55,6 +57,7 @@ public class ProgressiveRequest extends FileRequest {
return new String(asBytes());
}
@Override
public byte[] asBytes() throws IOException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
processResponse(request.execute(), os);