You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
702 B

  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. package httputil
  7. import (
  8. "net/http"
  9. "testing"
  10. )
  11. func TestCacheBusters(t *testing.T) {
  12. cbs := &CacheBusters{Handler: http.FileServer(http.Dir("."))}
  13. token := cbs.Get("/buster_test.go")
  14. if token == "" {
  15. t.Errorf("could not extract token from http.FileServer")
  16. }
  17. var ss StaticServer
  18. cbs = &CacheBusters{Handler: ss.FileHandler("buster_test.go")}
  19. token = cbs.Get("/xxx")
  20. if token == "" {
  21. t.Errorf("could not extract token from StaticServer FileHandler")
  22. }
  23. }