diff --git a/cmd/stepd/handler.go b/cmd/stepd/handler.go index 3641c86..a1e2fcb 100644 --- a/cmd/stepd/handler.go +++ b/cmd/stepd/handler.go @@ -53,15 +53,15 @@ func (this *handler) ServeHTTP (res http.ResponseWriter, req *http.Request) { return } - // TODO: serve a directory - // have a custom directory listing document that takes in a list - // of the files in the directory and the path to the directory - // as data - if !this.directories { this.serveError(res, req, http.StatusForbidden, req.URL) return } + + // TODO: serve a directory and return + // have a custom directory listing document that takes in a list + // of the files in the directory and the path to the directory + // as data } this.serveFile(res, req, filesystem, pat) @@ -85,8 +85,12 @@ func (this *handler) serveFile (res http.ResponseWriter, req *http.Request, file log.Println(document.ContentType) res.Header().Set("Content-Type", document.ContentType) } + data := step.HTTPData { } + data.Res.Header = make(http.Header) + data.Res.WriteHeader = res.WriteHeader + data.Req = req err = document.Execute(res, step.ExecutionData { - Data: req, + Data: data, }) if err != nil { this.logErr(name, err)