Fix for using InputOf
package org.takes.tk;
import java.io.File;
-import java.io.IOException;
import java.net.HttpURLConnection;
-import java.nio.file.Files;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.cactoos.io.InputOf;
@@ -78,7 +76,7 @@ public final class TkFiles extends TkWrap {
super(
new Take() {
@Override
- public Response act(final Request request) throws IOException {
+ public Response act(final Request request) throws Exception {
final File file = new File(
base, new RqHref.Base(request).href().path()
);
@@ -90,7 +88,7 @@ public final class TkFiles extends TkWrap {
)
);
}
- return new RsWithBody(new InputOf(file));
+ return new RsWithBody(new InputOf(file).stream());
}
}
);
