summaryrefslogtreecommitdiff
path: root/src/pkg/net/http/example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/net/http/example_test.go')
-rw-r--r--src/pkg/net/http/example_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pkg/net/http/example_test.go b/src/pkg/net/http/example_test.go
index 2584afc43..ec814407d 100644
--- a/src/pkg/net/http/example_test.go
+++ b/src/pkg/net/http/example_test.go
@@ -49,3 +49,8 @@ func ExampleGet() {
res.Body.Close()
fmt.Printf("%s", robots)
}
+
+func ExampleFileServer() {
+ // we use StripPrefix so that /tmpfiles/somefile will access /tmp/somefile
+ http.Handle("/tmpfiles/", http.StripPrefix("/tmpfiles/", http.FileServer(http.Dir("/tmp"))))
+}