(fs http.FileSystem)
| 768 | } |
| 769 | |
| 770 | func maybeReadIndexBytes(fs http.FileSystem) []byte { |
| 771 | rootFile, err := fs.Open("index.html") |
| 772 | if err != nil { |
| 773 | return nil |
| 774 | } |
| 775 | |
| 776 | defer rootFile.Close() //nolint:errcheck |
| 777 | |
| 778 | rd, err := io.ReadAll(rootFile) |
| 779 | if err != nil { |
| 780 | return nil |
| 781 | } |
| 782 | |
| 783 | return rd |
| 784 | } |
| 785 | |
| 786 | // ServeStaticFiles configures HTTP handler that serves static files and dynamically patches index.html to embed CSRF token, etc. |
| 787 | func (s *Server) ServeStaticFiles(m *mux.Router, fs http.FileSystem) { |
no test coverage detected