aadd first files based on caddy-filemanager

This commit is contained in:
Henrique Dias committed 2017-06-18 13:57:38 +01:00
1 parent f185b9893b
commit 20baeeb41a
28 files changed
+10626 -1

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
package wrapper
import "net/http"
// ResponseWriterNoBody is a wrapper used to suprress the body of the response
// to a request. Mainly used for HEAD requests.
type ResponseWriterNoBody struct {
http.ResponseWriter
}
// NewResponseWriterNoBody creates a new ResponseWriterNoBody.
func NewResponseWriterNoBody(w http.ResponseWriter) *ResponseWriterNoBody {
return &ResponseWriterNoBody{w}
}
// Header executes the Header method from the http.ResponseWriter.
func (w ResponseWriterNoBody) Header() http.Header {
return w.ResponseWriter.Header()
}
// Write suprresses the body.
func (w ResponseWriterNoBody) Write(data []byte) (int, error) {
return 0, nil
}
// WriteHeader writes the header to the http.ResponseWriter.
func (w ResponseWriterNoBody) WriteHeader(statusCode int) {
w.ResponseWriter.WriteHeader(statusCode)
}