cmd/stepd: Pass HTTPData to document
This commit is contained in:
parent
a46cecd5b3
commit
5e7d279ee1
@ -53,15 +53,15 @@ func (this *handler) ServeHTTP (res http.ResponseWriter, req *http.Request) {
|
|||||||
return
|
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 {
|
if !this.directories {
|
||||||
this.serveError(res, req, http.StatusForbidden, req.URL)
|
this.serveError(res, req, http.StatusForbidden, req.URL)
|
||||||
return
|
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)
|
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)
|
log.Println(document.ContentType)
|
||||||
res.Header().Set("Content-Type", 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 {
|
err = document.Execute(res, step.ExecutionData {
|
||||||
Data: req,
|
Data: data,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.logErr(name, err)
|
this.logErr(name, err)
|
||||||
|
Loading…
Reference in New Issue
Block a user