diff options
Diffstat (limited to 'httputil/buster_test.go')
-rw-r--r-- | httputil/buster_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/httputil/buster_test.go b/httputil/buster_test.go new file mode 100644 index 0000000..eb44cf4 --- /dev/null +++ b/httputil/buster_test.go | |||
@@ -0,0 +1,29 @@ | |||
1 | // Copyright 2013 The Go Authors. All rights reserved. | ||
2 | // | ||
3 | // Use of this source code is governed by a BSD-style | ||
4 | // license that can be found in the LICENSE file or at | ||
5 | // https://developers.google.com/open-source/licenses/bsd. | ||
6 | |||
7 | package httputil | ||
8 | |||
9 | import ( | ||
10 | "net/http" | ||
11 | "testing" | ||
12 | ) | ||
13 | |||
14 | func TestCacheBusters(t *testing.T) { | ||
15 | cbs := &CacheBusters{Handler: http.FileServer(http.Dir("."))} | ||
16 | |||
17 | token := cbs.Get("/buster_test.go") | ||
18 | if token == "" { | ||
19 | t.Errorf("could not extract token from http.FileServer") | ||
20 | } | ||
21 | |||
22 | var ss StaticServer | ||
23 | cbs = &CacheBusters{Handler: ss.FileHandler("buster_test.go")} | ||
24 | |||
25 | token = cbs.Get("/xxx") | ||
26 | if token == "" { | ||
27 | t.Errorf("could not extract token from StaticServer FileHandler") | ||
28 | } | ||
29 | } | ||