We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 686049d commit 448ae80Copy full SHA for 448ae80
examples/sendfile.ooc
@@ -2,14 +2,16 @@ use web, fastcgi
2
3
import web/Application
4
import fastcgi/Server
5
-import io/[Reader, FileReader]
+import io/[FileReader, File]
6
7
8
-//TODO: update this to use the new body() writer
9
SendFile: class extends Application {
10
- processRequest: func -> Reader {
+ processRequest: func {
+ file := File new("../README")
11
+
12
response setHeader("Content-type", "text/plain; charset=utf-8")
- return FileReader new("../README")
13
+ response setHeader("Content-length", file size() toString())
14
+ response body() write(FileReader new(file))
15
}
16
17
0 commit comments